solarpowerlog trunk
ILogger Class Reference

#include <ILogger.h>

List of all members.

Public Types

enum  level {
  LL_OFF = 0, LL_FATAL, LL_ERROR, LL_WARN,
  LL_INFO, LL_DEBUG, LL_TRACE, LL_ALL
}

Public Member Functions

void Setup (const std::string &, const std::string &, const std::string &)
void Setup (const std::string &, const std::string &)
 ILogger ()
virtual ~ILogger ()
std::string getLoggername () const
bool IsEnabled (int)
void SetLogLevel (int)
void Log (int, std::string)
std::string & operator<< (std::string &os)
std::stringstream & operator<< (std::stringstream &os)

Detailed Description

Interface for logging services

This class is the interface to the underlying logging class. (planned: log4cxx)

Loggers can be attached to every object, and log4cxx allows to structure them into a hierarchy.

This class is responsible to give every object access to its own logger, and extract the logger's configuration out of the configuration file. (allowing to configure the log for each component individually)

The class is intended to use a composition or by inheritance.

Definition at line 344 of file ILogger.h.


Member Enumeration Documentation

Enumerator:
LL_OFF 
LL_FATAL 
LL_ERROR 
LL_WARN 
LL_INFO 
LL_DEBUG 
LL_TRACE 
LL_ALL 

Definition at line 348 of file ILogger.h.


Constructor & Destructor Documentation

ILogger::ILogger ( ) [inline]

the default constructor set up logging with the root logger.

Definition at line 381 of file ILogger.h.

virtual ILogger::~ILogger ( ) [inline, virtual]

Definition at line 383 of file ILogger.h.


Member Function Documentation

std::string ILogger::getLoggername ( ) const [inline]

Definition at line 385 of file ILogger.h.

bool ILogger::IsEnabled ( int  ) [inline]

Check if a logging statement would go through and if so setup logging level.

This function should be used before using the << operator, as this function will avoid calling all the ostream-operators.

Example:

 if (logger->IsEnabled(FATAL)) logger << "Fatal Error occured" <<endl;

Definition at line 400 of file ILogger.h.

void ILogger::Log ( int  ,
std::string   
) [inline]

Definition at line 409 of file ILogger.h.

std::stringstream& ILogger::operator<< ( std::stringstream &  os) [inline]

Definition at line 418 of file ILogger.h.

std::string& ILogger::operator<< ( std::string &  os) [inline]

Definition at line 413 of file ILogger.h.

void ILogger::SetLogLevel ( int  ) [inline]

Definition at line 405 of file ILogger.h.

void ILogger::Setup ( const std::string &  ,
const std::string &  ,
const std::string &   
) [inline]

Configure the logger with a name (to identify) , the configuration string (for retrieving logger config) and a section (under what hierarchy to place the logger)

Parameters:
nameof the logger
configurationpathwhere to retrieve the config
sectinwhere to place the logger

Definition at line 368 of file ILogger.h.

void ILogger::Setup ( const std::string &  ,
const std::string &   
) [inline]

Adding a logger in a lower hierarchy level (below a parent object) by just specifying the parent.

This logger will inheritate all settings by its parent, or, the XML file might configure it.

Definition at line 377 of file ILogger.h.


The documentation for this class was generated from the following file: