ibrcommon::Logger Class Reference

#include <Logger.h>

List of all members.

Classes

class  endl_flag
class  LoggerOutput

Public Types

enum  LogOptions { LOG_NONE = 0, LOG_TIMESTAMP = 1 << 0, LOG_HOSTNAME = 1 << 1, LOG_LEVEL = 1 << 2 }
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 flush ()

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 enableSyslog (const char *name, int option, int facility, const unsigned char logmask=LOGGER_INFO)

Static Public Attributes

static endl_flag endl

Friends

Loggeroperator<< (Logger &logger, endl_flag &)

Detailed Description

The Logger class is the heart of the logging framework.

Definition at line 57 of file Logger.h.


Member Enumeration Documentation

Enumerator:
LOGGER_EMERG 
LOGGER_ALERT 
LOGGER_CRIT 
LOGGER_ERR 
LOGGER_WARNING 
LOGGER_NOTICE 
LOGGER_INFO 
LOGGER_DEBUG 
LOGGER_ALL 

Definition at line 68 of file Logger.h.

Enumerator:
LOG_NONE 
LOG_TIMESTAMP 
LOG_HOSTNAME 
LOG_LEVEL 

Definition at line 60 of file Logger.h.


Constructor & Destructor Documentation

ibrcommon::Logger::Logger ( const Logger obj  ) 

Definition at line 26 of file Logger.cpp.

Referenced by alert(), critical(), debug(), emergency(), error(), info(), notice(), and warning().

ibrcommon::Logger::~Logger (  )  [virtual]

Definition at line 31 of file Logger.cpp.


Member Function Documentation

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.

Parameters:
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 85 of file Logger.cpp.

Referenced by main().

Logger ibrcommon::Logger::alert (  )  [static]

Definition at line 40 of file Logger.cpp.

References Logger(), and LOGGER_ALERT.

Logger ibrcommon::Logger::critical (  )  [static]

Definition at line 45 of file Logger.cpp.

References Logger(), and LOGGER_CRIT.

Logger ibrcommon::Logger::debug ( int  verbosity  )  [static]

Definition at line 70 of file Logger.cpp.

References Logger(), and LOGGER_DEBUG.

Logger ibrcommon::Logger::emergency (  )  [static]

Definition at line 35 of file Logger.cpp.

References Logger(), and LOGGER_EMERG.

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.

Parameters:
name The naming prefix for all log messages.
option Syslog specific options.
See also:
syslog.h
Parameters:
facility Syslog facility.
See also:
syslog.h
Parameters:
logmask This mask specify what will be written to the syslog. You can combine options with the or function.

Definition at line 90 of file Logger.cpp.

Referenced by main().

Logger ibrcommon::Logger::error (  )  [static]

Definition at line 50 of file Logger.cpp.

References Logger(), and LOGGER_ERR.

void ibrcommon::Logger::flush (  ) 

Flush the log message to the output/syslog.

Definition at line 98 of file Logger.cpp.

References LOGGER_ALERT, LOGGER_CRIT, LOGGER_DEBUG, LOGGER_EMERG, LOGGER_ERR, LOGGER_INFO, LOGGER_NOTICE, and LOGGER_WARNING.

int ibrcommon::Logger::getVerbosity (  )  [static]

Get the global verbosity of the logger.

Returns:
The verbosity level as number. Higher value leads to more output.

Definition at line 80 of file Logger.cpp.

Logger ibrcommon::Logger::info (  )  [static]

Definition at line 65 of file Logger.cpp.

References Logger(), and LOGGER_INFO.

Logger ibrcommon::Logger::notice (  )  [static]

Definition at line 60 of file Logger.cpp.

References Logger(), and LOGGER_NOTICE.

void ibrcommon::Logger::setVerbosity ( const int  verbosity  )  [static]

Set the global verbosity of the logger.

Parameters:
verbosity A verbosity level as number. Higher value leads to more output.

Definition at line 75 of file Logger.cpp.

Referenced by main().

Logger ibrcommon::Logger::warning (  )  [static]

Definition at line 55 of file Logger.cpp.

References Logger(), and LOGGER_WARNING.


Friends And Related Function Documentation

Logger& operator<< ( Logger logger,
endl_flag  
) [friend]

Definition at line 142 of file Logger.h.


Member Data Documentation

Definition at line 139 of file Logger.h.


The documentation for this class was generated from the following files:
Generated on Mon Aug 23 08:13:01 2010 for IBR-DTNSuite by  doxygen 1.6.3