IBR-DTNSuite
0.8
|
#include <Logger.h>
Classes | |
class | LoggerOutput |
class | LogWriter |
Public Types | |
enum | LogOptions { LOG_NONE = 0, LOG_DATETIME = 1 << 0, LOG_HOSTNAME = 1 << 1, LOG_LEVEL = 1 << 2, LOG_TIMESTAMP = 1 << 3 } |
enum | LogLevel { LOGGER_EMERG = 1 << 0, LOGGER_ALERT = 1 << 1, LOGGER_CRIT = 1 << 2, LOGGER_ERR = 1 << 3, LOGGER_WARNING = 1 << 4, LOGGER_NOTICE = 1 << 5, LOGGER_INFO = 1 << 6, LOGGER_DEBUG = 1 << 7, LOGGER_ALL = 0xff } |
Public Member Functions | |
Logger (const Logger &) | |
virtual | ~Logger () |
void | print () |
Static Public Member Functions | |
static Logger | emergency () |
static Logger | alert () |
static Logger | critical () |
static Logger | error () |
static Logger | warning () |
static Logger | notice () |
static Logger | info () |
static Logger | debug (int verbosity) |
static void | setVerbosity (const int verbosity) |
static int | getVerbosity () |
static void | addStream (std::ostream &stream, const unsigned char logmask=LOGGER_INFO, const unsigned char options=LOG_NONE) |
static void | setLogfile (const ibrcommon::File &logfile, const unsigned char logmask=LOGGER_INFO, const unsigned char options=LOG_NONE) |
static void | enableSyslog (const char *name, int option, int facility, const unsigned char logmask=LOGGER_INFO) |
static void | enableAsync () |
static void | enableBuffer (size_t size) |
static void | writeBuffer (std::ostream &) |
static void | stop () |
static void | reload () |
ibrcommon::Logger::Logger | ( | const Logger & | obj | ) |
Definition at line 28 of file Logger.cpp.
Referenced by alert(), critical(), debug(), emergency(), error(), info(), notice(), and warning().
ibrcommon::Logger::~Logger | ( | ) | [virtual] |
Definition at line 33 of file Logger.cpp.
void ibrcommon::Logger::addStream | ( | std::ostream & | stream, |
const unsigned char | logmask = LOGGER_INFO , |
||
const unsigned char | options = LOG_NONE |
||
) | [static] |
Add a standard output stream to the logging framework.
stream | Standard output stream |
logmask | This mask specify what will be written to this stream. You can combine options with the or function. |
options | This mask specify what will be added to each log message. You can combine options with the or function. |
Definition at line 97 of file Logger.cpp.
Referenced by __daemon_run(), main(), and sighandler().
Logger ibrcommon::Logger::alert | ( | ) | [static] |
Definition at line 42 of file Logger.cpp.
References Logger(), and LOGGER_ALERT.
Logger ibrcommon::Logger::critical | ( | ) | [static] |
Definition at line 47 of file Logger.cpp.
References Logger(), and LOGGER_CRIT.
Logger ibrcommon::Logger::debug | ( | int | verbosity | ) | [static] |
Definition at line 72 of file Logger.cpp.
References Logger(), and LOGGER_DEBUG.
Logger ibrcommon::Logger::emergency | ( | ) | [static] |
Definition at line 37 of file Logger.cpp.
References Logger(), and LOGGER_EMERG.
void ibrcommon::Logger::enableAsync | ( | ) | [static] |
enable the asynchronous logging This starts a seperate thread and a thread-safe queue to queue all logging messages first and call the log routine by the thread. This option is nessacary, if the stream to log into are not thread-safe by itself.
Definition at line 310 of file Logger.cpp.
Referenced by __daemon_run().
void ibrcommon::Logger::enableBuffer | ( | size_t | size | ) | [static] |
Enables the internal ring-buffer.
size | The size of the buffer. |
Definition at line 315 of file Logger.cpp.
Referenced by __daemon_run().
void ibrcommon::Logger::enableSyslog | ( | const char * | name, |
int | option, | ||
int | facility, | ||
const unsigned char | logmask = LOGGER_INFO |
||
) | [static] |
Enable logging message to the system syslog.
name | The naming prefix for all log messages. |
option | Syslog specific options. |
facility | Syslog facility. |
logmask | This mask specify what will be written to the syslog. You can combine options with the or function. |
Definition at line 112 of file Logger.cpp.
Referenced by __daemon_run().
Logger ibrcommon::Logger::error | ( | ) | [static] |
Definition at line 52 of file Logger.cpp.
References Logger(), and LOGGER_ERR.
int ibrcommon::Logger::getVerbosity | ( | ) | [static] |
Get the global verbosity of the logger.
Definition at line 87 of file Logger.cpp.
Logger ibrcommon::Logger::info | ( | ) | [static] |
Definition at line 67 of file Logger.cpp.
References Logger(), and LOGGER_INFO.
Logger ibrcommon::Logger::notice | ( | ) | [static] |
Definition at line 62 of file Logger.cpp.
References Logger(), and LOGGER_NOTICE.
void ibrcommon::Logger::print | ( | ) |
Print the log message to the log output (or queue it in the writer)
Definition at line 117 of file Logger.cpp.
void ibrcommon::Logger::reload | ( | ) | [static] |
Reload the logger. This re-opens the logfile for output.
Definition at line 344 of file Logger.cpp.
Referenced by sighandler().
void ibrcommon::Logger::setLogfile | ( | const ibrcommon::File & | logfile, |
const unsigned char | logmask = LOGGER_INFO , |
||
const unsigned char | options = LOG_NONE |
||
) | [static] |
Set the logfile for the logging framework.
logfile | The file to log into. |
logmask | This mask specify what will be written to this stream. You can combine options with the or function. |
options | This mask specify what will be added to each log message. You can combine options with the or function. |
Definition at line 102 of file Logger.cpp.
Referenced by __daemon_run().
void ibrcommon::Logger::setVerbosity | ( | const int | verbosity | ) | [static] |
Set the global verbosity of the logger.
verbosity | A verbosity level as number. Higher value leads to more output. |
Definition at line 77 of file Logger.cpp.
Referenced by __daemon_run(), and sighandler().
void ibrcommon::Logger::stop | ( | ) | [static] |
stops the asynchronous logging thread you need to call this before your programm is going down, if you have called enableAsync() before.
Definition at line 338 of file Logger.cpp.
Referenced by __daemon_run().
Logger ibrcommon::Logger::warning | ( | ) | [static] |
Definition at line 57 of file Logger.cpp.
References Logger(), and LOGGER_WARNING.
void ibrcommon::Logger::writeBuffer | ( | std::ostream & | stream | ) | [static] |
Write the buffer to a stream
Definition at line 320 of file Logger.cpp.
References LOG_DATETIME, LOG_LEVEL, and LOGGER_ALL.