/usr/include/log4shib/FileAppender.hh is in liblog4shib-dev 1.0.9-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /*
* FileAppender.hh
*
* Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
* Copyright 2000, Bastiaan Bakker. All rights reserved.
*
* See the COPYING file for the terms of usage and distribution.
*/
#ifndef _LOG4SHIB_FILEAPPENDER_HH
#define _LOG4SHIB_FILEAPPENDER_HH
#include <log4shib/Portability.hh>
#include <log4shib/LayoutAppender.hh>
#include <string>
#include <stdarg.h>
namespace log4shib {
class LOG4SHIB_EXPORT FileAppender : public LayoutAppender {
public:
/**
Constructs a FileAppender.
@param name the name of the Appender.
@param fileName the name of the file to which the Appender has
to log.
@param append whether the Appender has to truncate the file or
just append to it if it already exists. Defaults to 'true'.
@param mode file mode to open the logfile with. Defaults to 00644.
**/
FileAppender(const std::string& name, const std::string& fileName,
bool append = true, mode_t mode = 00644);
/**
Constructs a FileAppender to an already open file descriptor.
@param name the name of the Appender.
@param fd the file descriptor to which the Appender has to log.
**/
FileAppender(const std::string& name, int fd);
virtual ~FileAppender();
/**
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.
@returns true if the reopen succeeded.
**/
virtual bool reopen();
/**
Closes the logfile.
**/
virtual void close();
/**
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().
@param append false to truncate, true to append
**/
virtual void setAppend(bool append);
/**
Gets the value of the 'append' option.
**/
virtual bool getAppend() const;
/**
Sets the file open mode.
**/
virtual void setMode(mode_t mode);
/**
Gets the file open mode.
**/
virtual mode_t getMode() const;
protected:
virtual void _append(const LoggingEvent& event);
const std::string _fileName;
int _fd;
int _flags;
mode_t _mode;
};
}
#endif // _LOG4SHIB_FILEAPPENDER_HH
|