|
solarpowerlog trunk
|
#include <ILogger.h>
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) |
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.
| enum ILogger::level |
| ILogger::ILogger | ( | ) | [inline] |
| 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;
| std::stringstream& ILogger::operator<< | ( | std::stringstream & | os | ) | [inline] |
| std::string& ILogger::operator<< | ( | std::string & | os | ) | [inline] |
| 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)
| name | of the logger |
| configurationpath | where to retrieve the config |
| sectin | where to place the logger |
| void ILogger::Setup | ( | const std::string & | , |
| const std::string & | |||
| ) | [inline] |