Loading...
Searching...
No Matches
Appender.hh
Go to the documentation of this file.
/*
* 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 _LOG4SHIB_APPENDER_HH
#define _LOG4SHIB_APPENDER_HH
#include <log4shib/Portability.hh>
#include <string>
#include <map>
#include <set>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <log4shib/Priority.hh>
#include <log4shib/Layout.hh>
#include <log4shib/LoggingEvent.hh>
#include <log4shib/threading/Threading.hh>
namespace log4shib {
class LOG4SHIB_EXPORT Filter;
class LOG4SHIB_EXPORT Appender {
public:
static Appender* getAppender(const std::string& name);
static bool reopenAll();
static void closeAll();
protected:
Appender(const std::string& name);
public:
virtual ~Appender();
virtual void doAppend(const LoggingEvent& event) = 0;
virtual bool reopen() = 0;
virtual void close() = 0;
virtual bool requiresLayout() const = 0;
virtual void setLayout(Layout* layout) = 0;
inline const std::string& getName() const { return _name; };
virtual void setThreshold(Priority::Value priority) = 0;
virtual Priority::Value getThreshold() = 0;
virtual void setFilter(Filter* filter) = 0;
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 // _LOG4SHIB_APPENDER_HH
LOG4SHIB_EXPORT
#define LOG4SHIB_EXPORT
Definition Export.hh:11
Layout.hh
LoggingEvent.hh
Portability.hh
Priority.hh
Threading.hh
log4shib::Appender::getFilter
virtual Filter * getFilter()=0
Get the Filter for this appender.
log4shib::Appender::closeAll
static void closeAll()
Call reopen() on all existing Appenders.
Definition Appender.cpp:52
log4shib::Appender::getName
const std::string & getName() const
Get the name of this appender.
Definition Appender.hh:106
log4shib::Appender::setFilter
virtual void setFilter(Filter *filter)=0
Set a Filter for this appender.
log4shib::Appender::reopenAll
static bool reopenAll()
Call reopen() on all existing Appenders.
Definition Appender.cpp:41
log4shib::Appender::close
virtual void close()=0
Release any resources allocated within the appender such as file handles, network connections,...
log4shib::Appender::Appender
Appender(const std::string &name)
Constructor for Appender.
Definition Appender.cpp:70
log4shib::Appender::setLayout
virtual void setLayout(Layout *layout)=0
Set the Layout for this appender.
log4shib::Appender::doAppend
virtual void doAppend(const LoggingEvent &event)=0
Log in Appender specific way.
log4shib::Appender::getAppender
static Appender * getAppender(const std::string &name)
Get a pointer to an exitsing Appender.
Definition Appender.cpp:23
log4shib::Appender::getThreshold
virtual Priority::Value getThreshold()=0
Get the threshold priority of this Appender.
log4shib::Appender::reopen
virtual bool reopen()=0
Reopens the output destination of this Appender, e.g.
log4shib::Appender::setThreshold
virtual void setThreshold(Priority::Value priority)=0
Set the threshold priority of this Appender.
log4shib::Appender::requiresLayout
virtual bool requiresLayout() const =0
Check if the appender uses a layout.
log4shib::Filter
Users should extend this class to implement customized logging event filtering.
Definition Filter.hh:49
log4shib::Layout
Extend this abstract class to create your own log layout format.
Definition Layout.hh:22
log4shib::Priority::Value
int Value
The type of Priority Values.
Definition Priority.hh:84
log4shib::threading::Mutex
Definition PThreads.hh:29
log4shib
The top level namespace for all 'Log for C++' types and classes.
Definition AbortAppender.hh:16
log4shib::AppenderSet
std::set< Appender * > AppenderSet
Definition Appender.hh:147
log4shib::LoggingEvent
The internal representation of logging events.
Definition LoggingEvent.hh:32