#include <Log.h>
Collaboration diagram for genetiK::util::Log:
Public Member Functions | |
void | setLevel (ELogLevel level) |
Set the Log threshold Sets the ELogLevel used to filter incoming messages. Only messages having ELogLevel >= level will be logged. | |
ELogLevel | getLevel () const |
Get the current Log threshold Retrieves ELogLevel used to filter incoming messages. Only messages having level >= are be logged. | |
int | setTarget (ostream *targetStream) |
Set the output stream to use for log messages. | |
int | setTarget (const char *filename, bool append) |
Set the output file to use for log messages Opens the specified file and writes log messages to it. The boolean argument permits to specify if output messages should be appended or not. | |
ostream * | getTarget () const |
Get the log's target stream. | |
int | output (ELogLevel level, const string &message) |
Demands logging of a message with the specified priority level. | |
int | debug (const string &message) |
Log message with DEBUG level. | |
int | info (const string &message) |
Log message with INFO level. | |
int | warn (const string &message) |
Log message with WARN level. | |
int | error (const string &message) |
Log message with ERROR level. | |
int | fatal (const string &message) |
Log message with FATAL level. | |
bool | isDebugEnabled () const |
Check if DEBUG messages are logged. | |
bool | isInfoEnabled () const |
Check if INFO messages are logged. | |
bool | isWarnEnabled () const |
Check if WARN messages are logged. | |
bool | isErrorEnabled () const |
Check if ERROR messages are logged. | |
bool | isFatalEnabled () const |
Check if FATAL messages are logged. | |
bool | isEnabled (ELogLevel level) const |
Check if messages having specified priority are logged. | |
Static Public Member Functions | |
static Log * | getInstance () |
Retrieve the Log instance As in classes that implement Singleton pattern, this method retrieves the (unique) instance of the Log class. If the instance doesn't already exist, it is created. | |
static void | deleteInstance () |
Delete the Log instance. |
This class is a sort of lightweight standalone logger. It can be used to selectively log all messages having priority greater or equal than a specified level (see ELogLevel for more details) to a specific target (file or output stream). Default behaviour is to log messages having priority >= than genetiK::util::WARN to standard output.
The Log class also exposes a set of is{ELogLevel}Enabled() methods, to check if a particular log level is enabled. These methods are useful to avoid the overhead needed to generate the actual log messages when the appropriate log level is disabled.
|
Log message with DEBUG level.
|
|
Log message with ERROR level.
|
|
Log message with FATAL level.
|
|
Retrieve the Log instance As in classes that implement Singleton pattern, this method retrieves the (unique) instance of the Log class. If the instance doesn't already exist, it is created.
|
|
Get the current Log threshold Retrieves ELogLevel used to filter incoming messages. Only messages having level >= are be logged.
|
|
Get the log's target stream.
|
|
Log message with INFO level.
|
|
Check if DEBUG messages are logged.
|
|
Check if messages having specified priority are logged.
|
|
Check if ERROR messages are logged.
|
|
Check if FATAL messages are logged.
|
|
Check if INFO messages are logged.
|
|
Check if WARN messages are logged.
|
|
Demands logging of a message with the specified priority level. Messages will be logged if level >= threshold.
|
|
Set the Log threshold Sets the ELogLevel used to filter incoming messages. Only messages having ELogLevel >= level will be logged.
|
|
Set the output file to use for log messages Opens the specified file and writes log messages to it. The boolean argument permits to specify if output messages should be appended or not.
|
|
Set the output stream to use for log messages.
|
|
Log message with WARN level.
|