|
ContRap-Core
|
Logger collects logging messages and returns them to a desired target on demand. More...
#include <logger.h>
Public Member Functions | |
| ~Logger () | |
| Releases the memory. | |
| void | set_message_level (MessageLevel message_level) |
| Sets the debug level. | |
| MessageLevel | get_message_level () |
| Returns the current debug level. | |
| void | clear_filters () |
| Clears the filters. | |
| void | set_filter (const std::string &sender, bool status) |
| Adds a sender filter status. | |
| void | log_to_stream (std::ostream *stream) |
| Configures the logger to log to a stream. | |
| void | log (const std::string &message, MessageType type=COMMENT_MESSAGE, const std::string &sender="") |
| Adds a message to log. | |
| LoggerMessage | get_next_message () |
| Returns the next message to process. | |
| bool | has_messages () |
| Returns true if the logger has pending messages. | |
| void | set_stdout_echo (bool status) |
| Sets if the logger should echo the logged messages to the standard output. | |
| void | dump_to_stdout () |
| Dumps the logger content to standard output. | |
Static Public Member Functions | |
| static Logger * | get_instance () |
| Returns the instance of the logger. | |
| static bool | is_finalized () |
| Returns true if the logger is finalized. | |
Protected Attributes | |
| Dispatcher * | dispatcher |
| Dispatcher. | |
| std::queue< LoggerMessage > | messages |
| Container for the messages. | |
| std::ostream * | stream |
| Logging stream. | |
| MessageLevel | message_level |
| Debug message level. | |
| bool | stdout_echo |
| If this flag is set to true the logger echoes to the standard output. | |
| std::map< std::string, bool > | filters |
| Sender filters. | |
Static Protected Attributes | |
| static Logger * | logger |
| Instance of the logger. | |
| static bool | finalized |
| Set to true if the logger is initialized. | |
Logger collects logging messages and returns them to a desired target on demand.
| crp::Logger::~Logger | ( | ) |
Releases the memory.
| void crp::Logger::clear_filters | ( | ) |
Clears the filters.
| void crp::Logger::dump_to_stdout | ( | ) |
Dumps the logger content to standard output.
| static Logger* crp::Logger::get_instance | ( | ) | [static] |
Returns the instance of the logger.
| MessageLevel crp::Logger::get_message_level | ( | ) | [inline] |
Returns the current debug level.
| LoggerMessage crp::Logger::get_next_message | ( | ) |
Returns the next message to process.
| bool crp::Logger::has_messages | ( | ) | [inline] |
Returns true if the logger has pending messages.
| static bool crp::Logger::is_finalized | ( | ) | [inline, static] |
Returns true if the logger is finalized.
| void crp::Logger::log | ( | const std::string & | message, |
| MessageType | type = COMMENT_MESSAGE, |
||
| const std::string & | sender = "" |
||
| ) |
Adds a message to log.
| message | String of the message |
| type | Type of the message |
| sender | A string identifying the caller |
| void crp::Logger::log_to_stream | ( | std::ostream * | stream | ) |
Configures the logger to log to a stream.
| stream | Output stream, e.g. file |
| void crp::Logger::set_filter | ( | const std::string & | sender, |
| bool | status | ||
| ) |
Adds a sender filter status.
| sender | Name of the sender allowed to log. |
| status | If set to false the sender is not allowed to log. |
| void crp::Logger::set_message_level | ( | MessageLevel | message_level | ) |
Sets the debug level.
| debug_level | New debug level |
| void crp::Logger::set_stdout_echo | ( | bool | status | ) | [inline] |
Sets if the logger should echo the logged messages to the standard output.
| status | If set to true echo is enabled. |
Dispatcher* crp::Logger::dispatcher [protected] |
Dispatcher.
std::map<std::string, bool> crp::Logger::filters [protected] |
Sender filters.
bool crp::Logger::finalized [static, protected] |
Set to true if the logger is initialized.
Logger* crp::Logger::logger [static, protected] |
Instance of the logger.
MessageLevel crp::Logger::message_level [protected] |
Debug message level.
std::queue<LoggerMessage> crp::Logger::messages [protected] |
Container for the messages.
bool crp::Logger::stdout_echo [protected] |
If this flag is set to true the logger echoes to the standard output.
std::ostream* crp::Logger::stream [protected] |
Logging stream.
1.7.3