openDAQ
Open data acquisition platform
LoggerPtr Class Reference

Represents a collection of Logger Components with multiple Logger Sinks and a single Logger Thread Pool shared between components. More...

Inherits ObjectPtr< ILogger >.

Detailed Description

Represents a collection of Logger Components with multiple Logger Sinks and a single Logger Thread Pool shared between components.

Logger is used to create, manage and maintain Logger Components associated with different parts of the openDAQ SDK. The Logger provides methods, allowing for components to be added and removed dynamically. The components added within the same Logger object should have unique names. Each newly added component inherits threshold log severity level from the Logger. Then this level can be changed independently per component. The set of sinks is initialized on the Logger object creation and cannot be changed after.

Additionally, Logger provides the ability to manage flushing policies for the added components, see flushOnLevel method.

Public Member Functions

void setLevel (daq::LogLevel level) const
 Sets the default log severity level. More...
 
daq::LogLevel getLevel () const
 Gets the default log severity level. More...
 
daq::LoggerComponentPtr getOrAddComponent (const daq::StringPtr &name) const
 Gets an added component by name or creates a new one with a given name and adds it to the Logger object. More...
 
daq::LoggerComponentPtr addComponent (const daq::StringPtr &name) const
 Creates a component with a given name and adds it to the Logger object. More...
 
void removeComponent (const daq::StringPtr &name) const
 Removes the component with a given name from the Logger object. More...
 
daq::ListPtr< daq::ILoggerComponent > getComponents () const
 Gets a list of added components. More...
 
daq::LoggerComponentPtr getComponent (const daq::StringPtr &name) const
 Gets an added component by name. More...
 
void flush () const
 Triggers writing out the messages stored in temporary buffers for added components and sinks associated with the Logger object.
 
void flushOnLevel (daq::LogLevel level) const
 Sets the minimum severity level of messages to be automatically flushed by components of Logger object. More...