24 #ifndef LOG4CPLUS_APPENDER_HEADER_
25 #define LOG4CPLUS_APPENDER_HEADER_
29 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
43 #include <condition_variable>
320 #if ! defined (LOG4CPLUS_SINGLE_THREADED)
330 #if ! defined (LOG4CPLUS_SINGLE_THREADED)
331 void subtract_in_flight();
Extend this class for implementing your own strategies for printing log statements.
std::mutex in_flight_mutex
void setThreshold(LogLevel th)
Set the threshold LogLevel.
virtual void close()=0
Release any resources allocated within the appender such as file handles, network connections,...
std::atomic< std::size_t > in_flight
void asyncDoAppend(const log4cplus::spi::InternalLoggingEvent &event)
This method performs book keeping related to asynchronous logging and executes syncDoAppend() to do t...
bool isClosed() const
Check if this appender is in closed state.
LogLevel getThreshold() const
Returns this appenders threshold LogLevel.
bool async
Asynchronous append.
virtual log4cplus::tstring getName()
Get the name of this appender.
log4cplus::spi::FilterPtr filter
The first filter in the filter chain.
void addFilter(log4cplus::spi::FilterPtr f)
Add filter at the end of the filters chain.
void syncDoAppend(const log4cplus::spi::InternalLoggingEvent &event)
This method performs threshold checks and invokes filters before delegating actual logging to the sub...
virtual void setErrorHandler(std::unique_ptr< ErrorHandler > eh)
Set the ErrorHandler for this Appender.
virtual ErrorHandler * getErrorHandler()
Return the currently set ErrorHandler for this Appender.
tstring & formatEvent(const log4cplus::spi::InternalLoggingEvent &event) const
virtual Layout * getLayout()
Returns the layout of this appender.
bool useLockFile
Use lock file for inter-process synchronization of access to log file.
std::unique_ptr< ErrorHandler > errorHandler
It is assumed and enforced that errorHandler is never null.
std::condition_variable in_flight_condition
std::unique_ptr< Layout > layout
The layout variable does not need to be set if the appender implementation has its own layout.
virtual void setLayout(std::unique_ptr< Layout > layout)
Set the layout for this appender.
void doAppend(const log4cplus::spi::InternalLoggingEvent &event)
This function checks async flag.
log4cplus::tstring name
Appenders are named.
bool closed
Is this appender closed?
Appender(const log4cplus::helpers::Properties &properties)
virtual void setName(const log4cplus::tstring &name)
Set the name of this appender.
virtual void append(const log4cplus::spi::InternalLoggingEvent &event)=0
Subclasses of Appender should implement this method to perform actual logging.
bool isAsSevereAsThreshold(LogLevel ll) const
Check whether the message LogLevel is below the appender's threshold.
void waitToFinishAsyncLogging()
This method waits for all events that are being asynchronously logged to finish.
std::unique_ptr< helpers::LockFile > lockFile
Optional system wide synchronization lock.
LogLevel threshold
There is no LogLevel threshold filtering by default.
void addFilter(std::function< spi::FilterResult(const log4cplus::spi::InternalLoggingEvent &)>)
Add filter at the end of the filters chain.
log4cplus::spi::FilterPtr getFilter() const
Get the filter chain on this Appender.
void setFilter(log4cplus::spi::FilterPtr f)
Set the filter chain on this Appender.
void destructorImpl()
This function is for derived appenders to call from their destructors.
This class is used to "handle" errors encountered in an {}.
virtual void error(const log4cplus::tstring &err)=0
virtual ~ErrorHandler()=0
This class is used to layout strings sent to an {}.
virtual ~OnlyOnceErrorHandler()
virtual void error(const log4cplus::tstring &err)
The internal representation of logging events.
This header defines Filter and all of it's subclasses.
This header defines the LogLevel type.
helpers::SharedObjectPtr< Appender > SharedAppenderPtr
This is a pointer to an Appender.
std::basic_string< tchar > tstring
const LogLevel NOT_SET_LOG_LEVEL
The NOT_SET_LOG_LEVEL LogLevel is used to indicated that no particular LogLevel is desired and that t...
int LogLevel
Defines the minimum set of priorities recognized by the system, that is FATAL_LOG_LEVEL,...