Cogs.Foundation
|
Consumer is the base class for objects that want to consume log messages through the LogManager. More...
#include <Consumer.h>
Public Member Functions | |
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 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) |
Protected Attributes | |
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. | |
Private Attributes | |
Category | minimumCategory |
Static Private Attributes | |
static Category | defaultMinimumCategory = Category::Trace |
Consumer is the base class for objects that want to consume log messages through the LogManager.
Consumer implementations should override consumeMessage (which will be called from any thread) and deal with the incoming messages as they see fit.
Messages can be filtered by calling setMinimumCategory at any time, or by calling setDefaultMinimumCategory prior to consumer construction.
Cogs::Logging::Consumer::Consumer | ( | ) |
Constructs a new Consumer instance.
Consumers register themselves automatically with the LogManager system and will begin receiving messages almost immediately. *============================================================================================
References defaultMinimumCategory, Cogs::Logging::registerConsumer(), and setMinimumCategory().
|
virtual |
Unregisters this consumer from the LogManager and destroys this instance.
*============================================================================================
References Cogs::Logging::unregisterConsumer(), and Cogs::Logging::updateMinimumCategory().
|
pure virtual |
|
inline |
|
static |
Retrieves a human-friendly name for the given category level.
*============================================================================================
|
static |
|
inline |
|
static |
Sets the default minimum category for all future consumers.
Set the default minimum category level of all consumers created after this call.
*============================================================================================
void Cogs::Logging::Consumer::setMinimumCategory | ( | Category | category | ) |
Set the minimum category level of messages that this consumer will output.
The lower the category value, the more noisy the log output will become. *============================================================================================
References Cogs::Logging::updateMinimumCategory().
Referenced by Consumer().
|
staticprivate |
Referenced by Consumer().
|
private |
|
protected |
Mutex available for implementations to use if needed.
|
protected |
Flag controlling whether or not to include the filenames for message sources.