/usr/include/log4cpp/Appender.hh is in liblog4cpp5-dev 1.0-4.1.
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /*
* Appender.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 _LOG4CPP_APPENDER_HH
#define _LOG4CPP_APPENDER_HH
#include <log4cpp/Portability.hh>
#include <string>
#include <map>
#include <set>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <log4cpp/Priority.hh>
#include <log4cpp/Layout.hh>
#include <log4cpp/LoggingEvent.hh>
#include <log4cpp/threading/Threading.hh>
namespace log4cpp {
class LOG4CPP_EXPORT Filter;
/**
* Implement this interface for your own strategies for printing log
* statements.
**/
class LOG4CPP_EXPORT Appender {
public:
/**
* Get a pointer to an exitsing Appender.
* @param name The name of the Appender to return.
* @returns a pointer to an existing Appender, or NULL if no appender
* with the specfied name exists.
**/
static Appender* getAppender(const std::string& name);
/**
* Call reopen() on all existing Appenders.
* @returns true if all Appenders returned true on their reopen() call.
**/
static bool reopenAll();
/**
* Call reopen() on all existing Appenders.
* @returns true if all Appenders returned true on their reopen() call.
**/
static void closeAll();
protected:
/**
* Constructor for Appender. Will only be used in getAppender() (and
* in derived classes of course).
* @param name The name of this Appender.
**/
Appender(const std::string& name);
public:
/**
* Destructor for Appender.
**/
virtual ~Appender();
/**
* Log in Appender specific way.
* @param event The LoggingEvent to log.
**/
virtual void doAppend(const LoggingEvent& event) = 0;
/**
* Reopens the output destination of this Appender, e.g. the logfile
* or TCP socket.
* @returns false if an error occured during reopening, true otherwise.
**/
virtual bool reopen() = 0;
/**
* Release any resources allocated within the appender such as file
* handles, network connections, etc.
**/
virtual void close() = 0;
/**
* Check if the appender uses a layout.
*
* @returns true if the appender implementation requires a layout.
**/
virtual bool requiresLayout() const = 0;
/**
* Set the Layout for this appender.
* @param layout The layout to use.
**/
virtual void setLayout(Layout* layout) = 0;
/**
* Get the name of this appender. The name identifies the appender.
* @returns the name of the appender.
**/
inline const std::string& getName() const { return _name; };
/**
* Set the threshold priority of this Appender. The Appender will not
* appender LoggingEvents with a priority lower than the threshold.
* Use Priority::NOTSET to disable threshold checking.
* @param priority The priority to set.
**/
virtual void setThreshold(Priority::Value priority) = 0;
/**
* Get the threshold priority of this Appender.
* @returns the threshold
**/
virtual Priority::Value getThreshold() = 0;
/**
* Set a Filter for this appender.
**/
virtual void setFilter(Filter* filter) = 0;
/**
* Get the Filter for this appender.
* @returns the filter, or NULL if no filter has been set.
**/
virtual Filter* getFilter() = 0;
private:
typedef std::map<std::string, Appender*> AppenderMap;
static AppenderMap* _allAppenders;
static threading::Mutex _appenderMapMutex;
static AppenderMap& _getAllAppenders();
static void _deleteAllAppenders();
static void _addAppender(Appender* appender);
static void _removeAppender(Appender* appender);
const std::string _name;
};
typedef std::set<Appender *> AppenderSet;
}
#endif // _LOG4CPP_APPENDER_HH
|