Cogs.Core
|
Console logger that supports splitting log lines between stdout and stderr according to severity. More...
#include <ConsoleLogger.h>
Public Member Functions | |
void | setUseColor (bool set_use_color) |
![]() | |
virtual void | consumeMessage (const char *source, Category category, uint32_t errorNumber, const char *message, const char *filename, int lineNumber) override |
Consumes a message being sent through the logging system. | |
void | flush (bool flushAll=true) |
Flushes some or all messages currently queued and awaiting a suitable time to be output. | |
![]() | |
Consumer () | |
Constructs a new Consumer instance. | |
virtual | ~Consumer () |
Unregisters this consumer from the LogManager and destroys this instance. | |
virtual void | consumeMessage (const char *source, Category category, uint32_t errorNumber, const char *message, const char *filename, int lineNumber)=0 |
Category | getMinimumCategory () const |
void | setMinimumCategory (Category category) |
Set the minimum category level of messages that this consumer will output. | |
void | enableFilenames (bool enable) |
Static Public Member Functions | |
static ConsoleLogger & | instance () |
static void | initialize () |
![]() | |
static void | setEnabled (bool enable) |
Enables or disables throttling of messages. | |
![]() | |
static void | setDefaultMinimumCategory (Category category) |
Sets the default minimum category for all future consumers. | |
static const char * | getCategoryName (Category category) |
Retrieves a human-friendly name for the given category level. | |
static const char * | getCategoryNameColor (Category category) |
Private Member Functions | |
virtual void | outputMessage (const std::string &prefix, const Message &message) override |
Private Attributes | |
bool | use_color = true |
Additional Inherited Members | |
![]() | |
Mutex | mutex |
Mutex available for implementations to use if needed. | |
bool | outputFilenames = false |
Flag controlling whether or not to include the filenames for message sources. | |
Console logger that supports splitting log lines between stdout and stderr according to severity.
By default, all logging goes to stderr, but that behaviour can be overridden by calling setStderrThreshold.
ConsoleLogger is a ThrottledConsumer. It will only receive non-spammy messages. Throttled messages will be periodically output with a counter showing how many duplicates were suppressed.
Definition at line 15 of file ConsoleLogger.h.
Cogs::Logging::ConsoleLogger::ConsoleLogger | ( | ) |
Definition at line 13 of file ConsoleLogger.cpp.
|
override |
Definition at line 21 of file ConsoleLogger.cpp.
|
inlinestatic |
Definition at line 22 of file ConsoleLogger.h.
|
static |
Definition at line 26 of file ConsoleLogger.cpp.
|
overrideprivatevirtual |
Implements Cogs::Logging::ThrottledConsumer.
Definition at line 33 of file ConsoleLogger.cpp.
|
inline |
Definition at line 23 of file ConsoleLogger.h.
|
private |
Definition at line 26 of file ConsoleLogger.h.