MIRA
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
LogCore Class Reference

Single instance of the core logging class. More...

#include <error/LoggingCore.h>

Inheritance diagram for LogCore:
Inheritance graph
[legend]

Public Types

typedef boost::function< void(SeverityLevel)> SeverityLevelChangedCallback
 Signature of a callback function for log severity level changes. More...
 
typedef Base::Type Type
 

Public Member Functions

 LogCore ()
 The Constructor. More...
 
LogRecordFunctionInfo parseFunction (const LogRecord &record)
 Parses the log record and extracts namespace, class name and function. More...
 
void setSeverityLevel (SeverityLevel level)
 Sets the application wide severity level. More...
 
SeverityLevel getSeverityLevel () const
 Get the application wide severity level. More...
 
uint32 registerCallback (SeverityLevelChangedCallback callback)
 Register a callback function. More...
 
void unregisterCallback (uint32 id)
 Unregister a callback function. More...
 
Duration getUptime () const
 Get the up-time of the core. More...
 
template<typename T >
LogSinkPtr registerSink (const T &sink)
 Register a new sink. More...
 
void unregisterSink (LogSinkPtr sink)
 Unregisters a sink. More...
 
void log (LogRecord &record)
 Writes a log record and distribute it between all the registered sinks. More...
 

Static Public Member Functions

static Typeinstance ()
 Returns a reference to the singleton instance. More...
 
static bool isDestroyed ()
 Returns true, if the singleton was already destroyed. More...
 

Static Protected Member Functions

static TypemakeInstance ()
 
static void destroyInstance (void)
 

Detailed Description

Single instance of the core logging class.

This class takes log records and distributes them between all registered sinks.

Member Typedef Documentation

◆ SeverityLevelChangedCallback

typedef boost::function<void(SeverityLevel)> SeverityLevelChangedCallback

Signature of a callback function for log severity level changes.

◆ Type

typedef Base::Type Type
inherited

Constructor & Destructor Documentation

◆ LogCore()

LogCore ( )

The Constructor.

Member Function Documentation

◆ parseFunction()

LogRecordFunctionInfo parseFunction ( const LogRecord record)

Parses the log record and extracts namespace, class name and function.

Parameters
recordThe record that will be parsed
Returns
information about the function, class and namespace

◆ setSeverityLevel()

void setSeverityLevel ( SeverityLevel  level)
inline

Sets the application wide severity level.

Parameters
levelThe new level.

◆ getSeverityLevel()

SeverityLevel getSeverityLevel ( ) const
inline

Get the application wide severity level.

Returns
The level.

◆ registerCallback()

uint32 registerCallback ( SeverityLevelChangedCallback  callback)
inline

Register a callback function.

The callback is called after the log severity level is changed by a call to setSeverityLevel.

Returns
Id number that can be used to unregister the callback

◆ unregisterCallback()

void unregisterCallback ( uint32  id)
inline

Unregister a callback function.

◆ getUptime()

Duration getUptime ( ) const
inline

Get the up-time of the core.

Returns
The up-time.

◆ registerSink()

LogSinkPtr registerSink ( const T &  sink)
inline

Register a new sink.

The sinks consume method is called upon a new log entry. Note: The sink must be copy constructible and inherited from LogSink.

Parameters
sinkThe sink to add.
Returns
A pointer to the registered sink.

◆ unregisterSink()

void unregisterSink ( LogSinkPtr  sink)
inline

Unregisters a sink.

Parameters
sinkThe sink that will be unregistered.

◆ log()

void log ( LogRecord record)
inline

Writes a log record and distribute it between all the registered sinks.

Never call this method directly. Use the macros MIRA_LOG, MIRA_LOG_ATTR or MIRA_LOG_EXCEPTION instead.

Parameters
recordThe log record.

◆ instance()

static Type& instance ( )
inlinestaticinherited

Returns a reference to the singleton instance.

Exceptions
XLogicalIf the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation).

◆ isDestroyed()

static bool isDestroyed ( )
inlinestaticinherited

Returns true, if the singleton was already destroyed.

Trying to access it will result in an exception.

◆ makeInstance()

static Type* makeInstance ( )
inlinestaticprotectedinherited

◆ destroyInstance()

static void destroyInstance ( void  )
inlinestaticprotectedinherited

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