Thread safe implementation of the logger. More...
#include <Logger.hpp>
Public Member Functions | |
void | begin (const std::string &message="") |
Logs a string with the level LOG_BEGIN. | |
void | disableAllLogLevels () |
Disables all outputs for all the levels, completely stopping the Logger. | |
void | disableAllLogLevels (shared_ptr< LogOutput > logOutput) |
Disables all levels for the given output. | |
virtual void | disableLogLevel (const LogLevel &logLevel) |
Disables all outputs for the specified logLevel. | |
virtual void | disableLogLevel (const LogLevel &logLevel, shared_ptr< LogOutput > logOutput) |
Disables a specified output for a specific level. | |
void | enableAllLogLevels (shared_ptr< LogOutput > logOutput) |
Enables all levels for the given output. | |
void | enableErrorLogLevels (shared_ptr< LogOutput > logOutput) |
Enables the error levels (LOG_ERROR, LOG_WARN and LOG_INFO) for the given output. | |
virtual void | enableLogLevel (const LogLevel &logLevel, shared_ptr< LogOutput > logOutput) |
Enables a specific output for a specific log level. | |
void | enableReportingLogLevels (shared_ptr< LogOutput > logOutput) |
Enables the reporting levels (LOG_BEGIN, LOG_END, LOG_STEP and LOG_SEPARATOR) for the given output. | |
void | end (const std::string &message="") |
Logs a string with the level LOG_END. | |
void | error (const std::string &message) |
Logs a string with the level LOG_ERROR. | |
void | info (const std::string &message) |
Logs a string with the level LOG_INFO. | |
void | log (const LogLevel &logLevel, const mermaid::support::data::DataBox &message) |
Logs a DataBox. | |
virtual void | log (const LogLevel &logLevel, const std::string &message) |
Logs a message, given in the form of a string. | |
void | separator (const std::string &message="") |
Logs a string with the level LOG_SEPARATOR. | |
virtual void | setPrefix (const std::string &prefix) |
Sets the prefix of the ThreadSafeLogger. | |
void | step (const std::string &message) |
Logs a string with the level LOG_STEP. | |
void | warn (const std::string &message) |
Logs a string with the level LOG_WARN. | |
Static Public Member Functions | |
static shared_ptr< Logger > | build (const std::string &prefix) |
Creates a new ThreadSafeLogger with the given prefix. | |
static shared_ptr< Logger > | build () |
Creates a new ThreadSafeLogger with an empty prefix. |
Thread safe implementation of the logger.
Definition at line 475 of file Logger.hpp.
void mermaid::support::logging::Logger::begin | ( | const std::string & | message = "" |
) | [inline, inherited] |
Logs a string with the level LOG_BEGIN.
message | The message to log. |
Definition at line 840 of file Logger.hpp.
shared_ptr< Logger > ThreadSafeLogger::build | ( | const std::string & | prefix | ) | [static] |
Creates a new ThreadSafeLogger with the given prefix.
prefix | The prefix to use. |
Definition at line 49 of file ThreadSafeLogger.cpp.
shared_ptr< Logger > ThreadSafeLogger::build | ( | ) | [static] |
Creates a new ThreadSafeLogger with an empty prefix.
Definition at line 42 of file ThreadSafeLogger.cpp.
void Logger::disableAllLogLevels | ( | ) | [inherited] |
Disables all outputs for all the levels, completely stopping the Logger.
This method will stop the logger if you need it. It is necessary because you cannot delete the logger, it is always a shared_ptr.
Definition at line 64 of file Logger.cpp.
void Logger::disableAllLogLevels | ( | shared_ptr< LogOutput > | logOutput | ) | [inherited] |
Disables all levels for the given output.
logOutput | Will disable the levels for this logOutput. |
Definition at line 54 of file Logger.cpp.
void ThreadSafeLogger::disableLogLevel | ( | const LogLevel & | logLevel | ) | [virtual] |
Disables all outputs for the specified logLevel.
logLevel | All the outputs of this level will be disabled. |
Implements mermaid::support::logging::Logger.
Definition at line 92 of file ThreadSafeLogger.cpp.
void ThreadSafeLogger::disableLogLevel | ( | const LogLevel & | logLevel, | |
shared_ptr< LogOutput > | logOutput | |||
) | [virtual] |
Disables a specified output for a specific level.
logLevel | The logOutput will be disabled only for this level. | |
logOutput | The logOutput to disble for the logLevel. |
Implements mermaid::support::logging::Logger.
Definition at line 83 of file ThreadSafeLogger.cpp.
void Logger::enableAllLogLevels | ( | shared_ptr< LogOutput > | logOutput | ) | [inherited] |
Enables all levels for the given output.
logOutput | Will enable the levels for this logOutput. |
Definition at line 49 of file Logger.cpp.
void Logger::enableErrorLogLevels | ( | shared_ptr< LogOutput > | logOutput | ) | [inherited] |
Enables the error levels (LOG_ERROR, LOG_WARN and LOG_INFO) for the given output.
logOutput | Will enable the levels for this logOutput. |
Definition at line 36 of file Logger.cpp.
void ThreadSafeLogger::enableLogLevel | ( | const LogLevel & | logLevel, | |
shared_ptr< LogOutput > | logOutput | |||
) | [virtual] |
Enables a specific output for a specific log level.
logLevel | The logLevel to associate. | |
logOutput | The logOutput to associate with the logLevel. |
Implements mermaid::support::logging::Logger.
Definition at line 74 of file ThreadSafeLogger.cpp.
void Logger::enableReportingLogLevels | ( | shared_ptr< LogOutput > | logOutput | ) | [inherited] |
Enables the reporting levels (LOG_BEGIN, LOG_END, LOG_STEP and LOG_SEPARATOR) for the given output.
logOutput | Will enable the levels for this logOutput. |
Definition at line 42 of file Logger.cpp.
void mermaid::support::logging::Logger::end | ( | const std::string & | message = "" |
) | [inline, inherited] |
Logs a string with the level LOG_END.
message | The message to log. |
Definition at line 852 of file Logger.hpp.
void mermaid::support::logging::Logger::error | ( | const std::string & | message | ) | [inline, inherited] |
Logs a string with the level LOG_ERROR.
message | The message to log. |
Definition at line 827 of file Logger.hpp.
void mermaid::support::logging::Logger::info | ( | const std::string & | message | ) | [inline, inherited] |
Logs a string with the level LOG_INFO.
message | The message to log. |
Definition at line 835 of file Logger.hpp.
void mermaid::support::logging::Logger::log | ( | const LogLevel & | logLevel, | |
const mermaid::support::data::DataBox & | message | |||
) | [inline, inherited] |
Logs a DataBox.
Please mind that this method is not affected by MERMAID_LOGGER_DISABLE_REPORTING.
logLevel | The log level to use. | |
message | The message to log. |
Definition at line 819 of file Logger.hpp.
void ThreadSafeLogger::log | ( | const LogLevel & | logLevel, | |
const std::string & | message | |||
) | [virtual] |
Logs a message, given in the form of a string.
This is the main method of the logger, all the others just call this one internally.
Please mind that this method is not affected by MERMAID_LOGGER_DISABLE_REPORTING.
logLevel | The log level to use. | |
message | The message to log. |
Implements mermaid::support::logging::Logger.
Definition at line 108 of file ThreadSafeLogger.cpp.
void mermaid::support::logging::Logger::separator | ( | const std::string & | message = "" |
) | [inline, inherited] |
Logs a string with the level LOG_SEPARATOR.
message | The message to log. |
Definition at line 844 of file Logger.hpp.
void ThreadSafeLogger::setPrefix | ( | const std::string & | prefix | ) | [virtual] |
Sets the prefix of the ThreadSafeLogger.
Each Logger can have exactly one prefix that is printed before every message.
prefix | The prefix to use. |
Implements mermaid::support::logging::Logger.
Definition at line 100 of file ThreadSafeLogger.cpp.
void mermaid::support::logging::Logger::step | ( | const std::string & | message | ) | [inline, inherited] |
Logs a string with the level LOG_STEP.
message | The message to log. |
Definition at line 848 of file Logger.hpp.
void mermaid::support::logging::Logger::warn | ( | const std::string & | message | ) | [inline, inherited] |
Logs a string with the level LOG_WARN.
message | The message to log. |
Definition at line 831 of file Logger.hpp.