log4tango::FileAppender(3)
π¦ log4tango::FileAppender(3) π¦
okay bestie, welcome to the manual page for log4tango::FileAppender, straight out of the log4tango manual. it writes your logs to a file. that's the whole vibe. let's get into it π
β¨ NAME β¨
log4tango::FileAppender β the appender that puts your logs in an actual file, no cap.
πΈ SYNOPSIS πΈ
#include <FileAppender.hh>
Inherits log4tango::LayoutAppender.
Inherited by log4tango::RollingFileAppender.
π Public Member Functions
FileAppender (const std::string &name, const std::string &fileName, bool append=true, mode_t mode=00644)β Constructs a FileAppender.FileAppender (const std::string &name, int fd)β Constructs a FileAppender to an already open file descriptor.virtual ~FileAppender ()β Destructor.virtual bool reopen (void)β Reopens the logfile.virtual void close (void)β Closes the logfile.virtual bool is_valid (void) constβ Check if the appender is valid.virtual void set_append (bool append)β Sets the append vs truncate flag.virtual bool get_append (void) constβ Gets the value of the 'append' option.virtual void set_mode (mode_t mode)β Sets the file open mode.virtual mode_t get_mode () constβ Gets the file open mode.
π§ Protected Member Functions
virtual int _append (const LoggingEvent &event)β Log in Appender specific way.
π Protected Attributes
const std::string _file_nameint _fdint _flagsmode_t _mode
π Additional Inherited Members
(this is the little section that tells you there's more stuff waiting for you up in the base class, iykyk π«Ά)
π Constructor & Destructor Documentation π
log4tango::FileAppender::FileAppender (const std::string & name, const std::string & fileName, bool append = true, mode_t mode = 00644)
Constructs a FileAppender. iconic behavior tbh β¨
Parameters
- name β the name of the Appender.
- fileName β the name of the file to which the Appender has to log.
- append β whether the Appender has to truncate the file or just append to it if it already exists. Defaults to
'true'. - mode β file mode to open the logfile with. Defaults to
00644.
log4tango::FileAppender::FileAppender (const std::string & name, int fd)
Constructs a FileAppender to an already open file descriptor. so if you already have an fd sitting there, this one's for you π
Parameters
- name β the name of the Appender.
- fd β the file descriptor to which the Appender has to log.
log4tango::FileAppender::~FileAppender () [virtual]
Destructor. it's giving closure, literally π¦
π₯ Member Function Documentation π₯
int log4tango::FileAppender::_append (const LoggingEvent & event) [protected], [virtual]
Log in Appender specific way. Subclasses of Appender should implement this method to perform actual logging. it's the "do the thing" method, fr fr.
Parameters
- event β The LoggingEvent to log.
Implements log4tango::Appender.
Reimplemented in log4tango::RollingFileAppender.
void log4tango::FileAppender::close (void) [virtual]
Closes the logfile. bye bye file π
Implements log4tango::Appender.
bool log4tango::FileAppender::get_append (void) const [virtual]
Gets the value of the 'append' option.
mode_t log4tango::FileAppender::get_mode (void) const [virtual]
Gets the file open mode.
bool log4tango::FileAppender::is_valid (void) const [virtual]
Check if the appender is valid. vibe check on the appender itself π
Returns
trueif the appender is valid,falseotherwise.
Reimplemented from log4tango::Appender.
bool log4tango::FileAppender::reopen (void) [virtual]
Reopens the logfile. This can be useful for logfiles that are rotated externally, e.g. by logrotate. This method is a NOOP for FileAppenders that have been constructed with a file descriptor.
heads up bestie: if you made this appender with a file descriptor, reopen does literally nothing. NOOP. not a single thing. π
Returns
trueif the reopen succeeded.
Reimplemented from log4tango::Appender.
void log4tango::FileAppender::set_append (bool append) [virtual]
Sets the append vs truncate flag. NB. currently the FileAppender opens the logfile in the constructor. Therefore this method is too late to influence the first file opening. We'll need something similar to log4j's activateOptions().
okay so this is the messy part π the file gets opened in the constructor, so callingset_appendafterwards is too late for that very first open. the manpage itself says we'd need something like log4j'sactivateOptions()β that's the author's own note, not mine, periodt.
Parameters
- append β
falseto truncate,trueto append
void log4tango::FileAppender::set_mode (mode_t mode) [virtual]
Sets the file open mode.
β Member Data Documentation β
int log4tango::FileAppender::_fd[protected]const std::string log4tango::FileAppender::_file_name[protected]int log4tango::FileAppender::_flags[protected]mode_t log4tango::FileAppender::_mode[protected]
π Author π
Generated automatically by Doxygen for log4tango from the source code. (yes, a robot wrote this, and it ate, ngl π€β¨)
and that's the whole page, bestie π«Ά this is Version 5.0.2, dated Thu Dec 5 2024 β go forth and log responsibly, mwah π πΈ
π¦ where this page comes from
- debian bookworm: liblog4tango-doc 9.3.4+dfsg1-2+deb12u1 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms