Application logger is a class that implements a logger that can be used by applications to save log file somewhere on the system.
More...
Inherits streambuf, and ostream.
Data Structures |
| class | Ident |
| | Ident class that represents module name. More...
|
Public Member Functions |
| void | alert (char *format,...) |
| | alert level printf style method, provided for convenience.
|
| AppLog & | alert (void) |
| | alert level
|
| | AppLog (char *logFileName=((void *) 0), bool logDirectly=false, bool usePipe=false) |
| | Constructor for a customized logger.
|
| void | clogEnable (bool en=true) |
| | Enables clog output.
|
|
void | close (void) |
| | if logDirectly is set it closes the file.
|
| void | critical (char *format,...) |
| | critical level printf style method, provided for convenience.
|
| AppLog & | critical (void) |
| | critical level
|
| void | debug (char *format,...) |
| | debug level printf style method, provided for convenience.
|
| AppLog & | debug (void) |
| | debug level
|
| void | emerg (char *format,...) |
| | emerg level printf style method, provided for convenience.
|
| AppLog & | emerg (void) |
| | emerg level
|
| void | error (char *format,...) |
| | error level printf style method, provided for convenience.
|
| AppLog & | error (void) |
| | error level
|
| void | identLevel (char *ident, Slog::Level level) |
| | Sets the level for that ident.
|
| void | info (char *format,...) |
| | info level printf style method, provided for convenience.
|
| AppLog & | info (void) |
| | info level
|
| void | level (Slog::Level enable) |
| | Sets the log level.
|
| void | logFileName (char *FileName, bool logDirectly=false, bool usePipe=false) |
| | Allows to set up ost::alog parameters.
|
| void | notice (char *format,...) |
| | notice level printf style method, provided for convenience.
|
| AppLog & | notice (void) |
| | notice level
|
| void | open (char *ident) |
| | Opens the file if not already and sets ident.
|
| AppLog & | operator() (char *ident, Slog::Level level=Slog::levelError) |
| | operator to change ident and log level
|
| AppLog & | operator() (Ident &ident) |
| | operator to change ident
|
| AppLog & | operator() (Slog::Level level) |
| | operator to change logging level
|
| AppLog & | operator<< (AppLog &(*pfManipulator)(AppLog &)) |
| | manipulator operator, to change print levels.
|
| AppLog & | operator<< (ostream &(*pfManipulator)(ostream &)) |
| | manipulator operator, to use ostream manipulators (i.e.
|
| AppLog & | operator<< (Ident &ident) |
| | operator <<
|
| virtual int | overflow (int c) |
| | stream overflow() overload.
|
| void | slogEnable (bool en=true) |
| | Enables slog output for error level messages.
|
|
void | subscribe () |
| | Subscribes the current thread to logger, it reserves thread safe buffer for it.
|
|
virtual int | sync () |
| | stream sync() overload
|
|
void | unsubscribe () |
| | Unsubscribes the current thread from logger.
|
| void | warn (char *format,...) |
| | warn level printf style method, provided for convenience.
|
| AppLog & | warn (void) |
| | warn level
|
|
virtual | ~AppLog () |
| | Destructor.
|
Static Public Member Functions |
| static Slog::Level | levelTranslate (string name) |
| | Translates level from string to Slog::Level, useful for configuration files for instance.
|
Protected Member Functions |
|
void | writeLog (bool endOfLine=true) |
Protected Attributes |
|
AppLogPrivate * | d |
Static Protected Attributes |
static std::map< string,
Slog::Level > * | assoc |
Friends |
|
ostream & | operator<< (ostream &out, AppLog &al) |
Application logger is a class that implements a logger that can be used by applications to save log file somewhere on the system.
It uses ost::slog to write to syslog and std::clog to write to standard output.
It provides either a stream oriented logger or a old printf style one.
It can be used to log directly on a file or in a spooler like way. Latter uses a ost::ThreadQueue to implement a thread safe access to logger.
It provides a global stream variable called ost::alog.
It provides an AppLog::Ident class that represents a module name for instance that can be used to tag logs. Logging levels are the same defined into ost::Slog: Slog::levelEmergency Slog::levelAlert Slog::levelCritical Slog::levelError Slog::levelWarning Slog::levelNotice Slog::levelInfo Slog::levelDebugfrom.
Example of usage: alog << mod_name << debug << "Hello world!" << std::endl;
Definition at line 171 of file applog.h.