Cogs.Foundation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
Cogs::Logging::Consumer Class Referenceabstract

Consumer is the base class for objects that want to consume log messages through the LogManager. More...

#include <Consumer.h>

Inheritance diagram for Cogs::Logging::Consumer:
Cogs::Logging::FileLogger Cogs::Logging::RedirectedLogger Cogs::Logging::StructuredLogger Cogs::Logging::ThrottledConsumer Cogs::Logging::ConsoleLogger

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Consumer()

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().

◆ ~Consumer()

Cogs::Logging::Consumer::~Consumer ( )
virtual

Unregisters this consumer from the LogManager and destroys this instance.

*============================================================================================

References Cogs::Logging::unregisterConsumer(), and Cogs::Logging::updateMinimumCategory().

Member Function Documentation

◆ consumeMessage()

virtual void Cogs::Logging::Consumer::consumeMessage ( const char *  source,
Category  category,
uint32_t  errorNumber,
const char *  message,
const char *  filename,
int  lineNumber 
)
pure virtual

◆ enableFilenames()

void Cogs::Logging::Consumer::enableFilenames ( bool  enable)
inline

◆ getCategoryName()

const char * Cogs::Logging::Consumer::getCategoryName ( Category  category)
static

Retrieves a human-friendly name for the given category level.

*============================================================================================

◆ getCategoryNameColor()

const char * Cogs::Logging::Consumer::getCategoryNameColor ( Category  category)
static

◆ getMinimumCategory()

Category Cogs::Logging::Consumer::getMinimumCategory ( ) const
inline

◆ setDefaultMinimumCategory()

void Cogs::Logging::Consumer::setDefaultMinimumCategory ( Category  category)
static

Sets the default minimum category for all future consumers.

Set the default minimum category level of all consumers created after this call.

*============================================================================================

◆ setMinimumCategory()

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().

Member Data Documentation

◆ defaultMinimumCategory

Cogs::Logging::Category Cogs::Logging::Consumer::defaultMinimumCategory = Category::Trace
staticprivate

Referenced by Consumer().

◆ minimumCategory

Category Cogs::Logging::Consumer::minimumCategory
private

◆ mutex

Mutex Cogs::Logging::Consumer::mutex
protected

Mutex available for implementations to use if needed.

◆ outputFilenames

bool Cogs::Logging::Consumer::outputFilenames = false
protected

Flag controlling whether or not to include the filenames for message sources.


The documentation for this class was generated from the following files: