|
IBR-DTNSuite
0.12
|
#include <Logger.h>


Public Member Functions | |
| virtual | ~LogWriter () |
| void | log (Logger &logger) |
| void | setVerbosity (const int verbosity) |
| int | getVerbosity () const |
| unsigned char | getLogMask () const |
| void | addStream (std::ostream &stream, const unsigned char logmask=Logger::LOGGER_INFO, const unsigned char options=Logger::LOG_NONE) |
| void | setLogfile (const ibrcommon::File &logfile, const unsigned char logmask=Logger::LOGGER_INFO, const unsigned char options=Logger::LOG_NONE) |
| void | enableSyslog (const char *name, int option, int facility, const unsigned char logmask=Logger::LOGGER_INFO) |
| void | enableAsync () |
| void | enableBuffer (size_t size) |
| void | reload () |
| void | writeBuffer (std::ostream &, const unsigned char logmask, const unsigned char options) |
| const std::string & | getDefaultTag () const |
| void | setDefaultTag (const std::string &value) |
Public Member Functions inherited from ibrcommon::JoinableThread | |
| virtual | ~JoinableThread ()=0 |
| void | join (void) throw (ThreadException) |
| bool | isRunning (void) |
| void | start (int priority=0) throw (ThreadException) |
| void | stop () throw () |
Static Public Member Functions | |
| static LogWriter & | getInstance () |
Protected Member Functions | |
| void | flush () |
| void | run () throw () |
| void | __cancellation () throw () |
Protected Member Functions inherited from ibrcommon::JoinableThread | |
| JoinableThread (size_t size=DEFAULT_STACKSIZE) | |
Protected Member Functions inherited from ibrcommon::Thread | |
| virtual | ~Thread ()=0 |
| void | reset () throw (ThreadException) |
| virtual void | setup (void) throw () |
| virtual void | finally (void) throw () |
| bool | isFinalized () throw () |
| bool | operator== (const ibrcommon::Thread &other) |
| Thread (size_t stack=DEFAULT_STACKSIZE) | |
| int | kill (int sig) |
| void | cancel () throw () |
Additional Inherited Members | |
Static Protected Member Functions inherited from ibrcommon::Thread | |
| static size_t | getNumberOfProcessors () |
| static void | yield (void) |
| static void | sleep (time_t timeout) |
| static void | concurrency (int level) |
| static bool | equal (pthread_t thread1, pthread_t thread2) |
| static void * | __execute__ (void *obj) throw () |
|
virtual |
Definition at line 498 of file Logger.cpp.
References ibrcommon::JoinableThread::join(), and ibrcommon::JoinableThread::stop().

|
protectedvirtual | |||||||||||||
Implements ibrcommon::Thread.
Definition at line 656 of file Logger.cpp.
| void ibrcommon::LogWriter::addStream | ( | std::ostream & | stream, |
| const unsigned char | logmask = Logger::LOGGER_INFO, |
||
| const unsigned char | options = Logger::LOG_NONE |
||
| ) |
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 152 of file Logger.cpp.
Referenced by ibrcommon::Logger::addStream().
| void ibrcommon::LogWriter::enableAsync | ( | ) |
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 438 of file Logger.cpp.
References ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::JoinableThread::start(), and ibrcommon::Exception::what().
Referenced by ibrcommon::Logger::enableAsync().

| void ibrcommon::LogWriter::enableBuffer | ( | size_t | size) |
Enables the internal ring-buffer.
| size | The size of the buffer. |
Definition at line 511 of file Logger.cpp.
Referenced by ibrcommon::Logger::enableBuffer().
| void ibrcommon::LogWriter::enableSyslog | ( | const char * | name, |
| int | option, | ||
| int | facility, | ||
| const unsigned char | logmask = Logger::LOGGER_INFO |
||
| ) |
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 168 of file Logger.cpp.
Referenced by ibrcommon::Logger::enableSyslog().
| const std::string & ibrcommon::LogWriter::getDefaultTag | ( | ) | const |
Return the default tag
Definition at line 595 of file Logger.cpp.
|
static |
Definition at line 485 of file Logger.cpp.
Referenced by ibrcommon::Logger::addStream(), ibrcommon::Logger::enableAsync(), ibrcommon::Logger::enableBuffer(), ibrcommon::Logger::enableSyslog(), ibrcommon::Logger::getLogMask(), ibrcommon::Logger::getVerbosity(), ibrcommon::Logger::print(), ibrcommon::Logger::reload(), ibrcommon::Logger::setDefaultTag(), ibrcommon::Logger::setLogfile(), ibrcommon::Logger::setVerbosity(), ibrcommon::Logger::stop(), and ibrcommon::Logger::writeBuffer().
| unsigned char ibrcommon::LogWriter::getLogMask | ( | ) | const |
Definition at line 132 of file Logger.cpp.
Referenced by ibrcommon::Logger::getLogMask().
| int ibrcommon::LogWriter::getVerbosity | ( | ) | const |
Get the global verbosity of the logger.
Definition at line 137 of file Logger.cpp.
Referenced by ibrcommon::Logger::getVerbosity().
| void ibrcommon::LogWriter::log | ( | Logger & | logger) |
Definition at line 605 of file Logger.cpp.
References flush().
Referenced by ibrcommon::Logger::print().

| void ibrcommon::LogWriter::reload | ( | ) |
Reload the logger. This re-opens the logfile for output.
Definition at line 554 of file Logger.cpp.
References ibrcommon::File::getPath().
Referenced by ibrcommon::Logger::reload().

|
protectedvirtual | |||||||||||||
Abstract interface for thread context run method.
Implements ibrcommon::Thread.
Definition at line 617 of file Logger.cpp.
References ibrcommon::Queue< T >::Locked::empty(), flush(), ibrcommon::Queue< T >::Locked::front(), and ibrcommon::Queue< T >::Locked::pop().

| void ibrcommon::LogWriter::setDefaultTag | ( | const std::string & | value) |
set the default tag to log
Definition at line 600 of file Logger.cpp.
Referenced by ibrcommon::Logger::setDefaultTag().
| void ibrcommon::LogWriter::setLogfile | ( | const ibrcommon::File & | logfile, |
| const unsigned char | logmask = Logger::LOGGER_INFO, |
||
| const unsigned char | options = Logger::LOG_NONE |
||
| ) |
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 518 of file Logger.cpp.
References ibrcommon::File::getPath().
Referenced by ibrcommon::Logger::setLogfile().

| void ibrcommon::LogWriter::setVerbosity | ( | const int | verbosity) |
Set the global verbosity of the logger.
| verbosity | A verbosity level as number. Higher value leads to more output. |
Definition at line 117 of file Logger.cpp.
Referenced by ibrcommon::Logger::setVerbosity().
| void ibrcommon::LogWriter::writeBuffer | ( | std::ostream & | stream, |
| const unsigned char | logmask, | ||
| const unsigned char | options | ||
| ) |
Write the buffer to a stream
Definition at line 581 of file Logger.cpp.
Referenced by ibrcommon::Logger::writeBuffer().