Nymph
v1.5.2
Flow-Based Data Processing Framework
|
#include <KTLogger.hh>
Classes | |
struct | Location |
struct | Private |
Public Types | |
enum | ELevel { eTrace, eDebug, eInfo, eProg, eWarn, eError, eFatal } |
Public Member Functions | |
KTLogger (const char *name=0) | |
KTLogger (const std::string &name) | |
virtual | ~KTLogger () |
bool | IsLevelEnabled (ELevel level) const |
void | SetLevel (ELevel level) const |
void | Log (ELevel level, const std::string &message, const Location &loc=Location()) |
void | LogTrace (const std::string &message, const Location &loc=Location()) |
void | LogDebug (const std::string &message, const Location &loc=Location()) |
void | LogInfo (const std::string &message, const Location &loc=Location()) |
void | LogProg (const std::string &message, const Location &loc=Location()) |
void | LogWarn (const std::string &message, const Location &loc=Location()) |
void | LogError (const std::string &message, const Location &loc=Location()) |
void | LogFatal (const std::string &message, const Location &loc=Location()) |
Static Public Member Functions | |
static KTLogger & | GetRootLogger () |
Private Attributes | |
Private * | fPrivate |
The Nymph logger.
The usage and syntax is inspired by log4j. logger itself uses the log4cxx library if it was available on the system during compiling, otherwise it falls back to std::stream.
The logger output can be configured in a file specified with the environment variable LOGGER_CONFIGURATION (by default log4cxx.properties in the config directory).
In most cases the following macro can be used to instantiate a Logger in your code:
LOGGER(myLogger, "loggerName");
This is equivalent to:
static Nymph::logger myLogger("loggerName");
For logging the following macros can be used. The source code location will then automatically included in the output:
KTLOG(myLogger, level, "message"); KTTRACE(myLogger, "message"); KTDEBUG(myLogger, "message"); KTINFO(myLogger, "message"); KTPROG(myLogger, "message"); KTWARN(myLogger, "message"); KTERROR(myLogger, "message"); KTFATAL(myLogger, "message");
KTASSERT(myLogger, assertion, "message");
KTLOG_ONCE(myLogger, level, "message"); KTTRACE_ONCE(myLogger, "message"); KTDEBUG_ONCE(myLogger, "message"); KTINFO_ONCE(myLogger, "message"); KTPROG_ONCE(myLogger, "message"); KTWARN_ONCE(myLogger, "message"); KTERROR_ONCE(myLogger, "message"); KTFATAL_ONCE(myLogger, "message");
Definition at line 121 of file KTLogger.hh.
enum ELevel |
Enumerator | |
---|---|
eTrace | |
eDebug | |
eInfo | |
eProg | |
eWarn | |
eError | |
eFatal |
Definition at line 124 of file KTLogger.hh.
KTLogger | ( | const char * | name = 0 | ) |
Standard constructor assigning a name to the logger instance.
name | The logger name. |
Definition at line 138 of file KTLogger.cc.
KTLogger | ( | const std::string & | name | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 154 of file KTLogger.cc.
|
virtual |
Definition at line 162 of file KTLogger.cc.
|
inlinestatic |
Definition at line 143 of file KTLogger.hh.
bool IsLevelEnabled | ( | ELevel | level | ) | const |
Check whether a certain log-level is enabled.
level | The log level as string representation. |
Definition at line 167 of file KTLogger.cc.
Log a message with the specified level. Use the macro LOG(logger, level, message).
level | The log level. |
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 183 of file KTLogger.cc.
Log a message at DEBUG level. Use the macro DEBUG(logger, message).
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 197 of file KTLogger.hh.
Log a message at ERROR level. Use the macro ERROR(logger, message).
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 237 of file KTLogger.hh.
Log a message at FATAL level. Use the macro FATAL(logger, message).
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 247 of file KTLogger.hh.
Log a message at INFO level. Use the macro INFO(logger, message).
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 207 of file KTLogger.hh.
Log a message at PROG level. Use the macro PROG(logger, message).
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 217 of file KTLogger.hh.
Log a message at TRACE level. Use the macro TRACE(logger, message).
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 187 of file KTLogger.hh.
Log a message at WARN level. Use the macro WARN(logger, message).
message | The message. |
loc | Source code location (set automatically by the corresponding macro). |
Definition at line 227 of file KTLogger.hh.
void SetLevel | ( | ELevel | level | ) | const |
Set a loggers minimum logging level
level | string identifying the log level |
Definition at line 172 of file KTLogger.cc.
|
private |
Definition at line 253 of file KTLogger.hh.