Cogs.Core
|
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.
Definition at line 18 of file Consumer.h.
Cogs::Logging::Consumer::Consumer | ( | ) |
Constructs a new Consumer instance.
Consumers register themselves automatically with the LogManager system and will begin receiving messages almost immediately. *============================================================================================
Definition at line 13 of file Consumer.cpp.
References Cogs::Logging::registerConsumer(), and setMinimumCategory().
|
virtual |
Unregisters this consumer from the LogManager and destroys this instance.
*============================================================================================
Definition at line 21 of file Consumer.cpp.
References Cogs::Logging::unregisterConsumer(), and Cogs::Logging::updateMinimumCategory().
|
pure virtual |
Implemented in Cogs::Logging::ThrottledConsumer.
|
inline |
Definition at line 28 of file Consumer.h.
|
static |
Retrieves a human-friendly name for the given category level.
*============================================================================================
Definition at line 46 of file Consumer.cpp.
|
static |
Definition at line 59 of file Consumer.cpp.
|
inline |
Definition at line 25 of file Consumer.h.
|
static |
Sets the default minimum category for all future consumers.
Set the default minimum category level of all consumers created after this call.
*============================================================================================
Definition at line 39 of file Consumer.cpp.
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. *============================================================================================
Definition at line 31 of file Consumer.cpp.
References Cogs::Logging::updateMinimumCategory().
Referenced by Consumer().
|
staticprivate |
Definition at line 43 of file Consumer.h.
|
private |
Definition at line 42 of file Consumer.h.
|
protected |
Mutex available for implementations to use if needed.
Definition at line 38 of file Consumer.h.
|
protected |
Flag controlling whether or not to include the filenames for message sources.
Definition at line 39 of file Consumer.h.