OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::LogDispatcher Class Reference

The LogDispatcher dispatches generated log messages to all registered log notifiers. When a log message is dispatched a timestamp for log messages and then forwards them to any registered log notifier. More...

#include "Logger.h"

Public Member Functions

void setLogFlag (LogFlag _flag, bool _active=true)
 
void setLogFlags (LogFlags _flags)
 
LogFlags logFlags (void) const
 
void setServiceName (const std::string &_name)
 
const std::string & serviceName (void) const
 
void setUserName (const std::string &_name)
 
const std::string & getUserName (void) const
 
void setProjectName (const std::string &_name)
 
const std::string & getProjectName (void) const
 
void addReceiver (AbstractLogNotifier *_receiver)
 Adds the provided receiver to the message receiver list. Every registered receiver will be notified about every log message that was created.
 
void forgetReceiver (AbstractLogNotifier *_receiver)
 
void dispatch (const std::string &_text, const std::string &_functionName=std::string(), const LogFlags &_logFlags=LogFlags(ot::INFORMATION_LOG))
 Dispatch a log message with the provided params. Will forward the created log message object to the dispatch(LogMessage) function. Will apply the current user and project names to the log message before dispatching.
 
void dispatch (const LogMessage &_message)
 Dispatch a log message with the provided params. Will set the current system time as message creation time (local system time). //! Will apply the current user and project names to the log message before dispatching.
 

Static Public Member Functions

static LogDispatcherinstance (void)
 
static LogDispatcherinitialize (const std::string &_serviceName, bool _addCoutReceiver=false)
 
static bool mayLog (LogFlag _flags)
 
static void addFileWriter (void)
 

Private Member Functions

virtual ~LogDispatcher ()
 

Detailed Description

The LogDispatcher dispatches generated log messages to all registered log notifiers. When a log message is dispatched a timestamp for log messages and then forwards them to any registered log notifier.

Member Function Documentation

◆ addFileWriter()

void ot::LogDispatcher::addFileWriter ( void )
static

◆ addReceiver()

void ot::LogDispatcher::addReceiver ( AbstractLogNotifier * _receiver)

Adds the provided receiver to the message receiver list. Every registered receiver will be notified about every log message that was created.

Parameters
_receiverThe receiver to add

◆ dispatch() [1/2]

void ot::LogDispatcher::dispatch ( const LogMessage & _message)

Dispatch a log message with the provided params. Will set the current system time as message creation time (local system time). //! Will apply the current user and project names to the log message before dispatching.

Parameters
_messageThe message to dispatch.

◆ dispatch() [2/2]

void ot::LogDispatcher::dispatch ( const std::string & _text,
const std::string & _functionName = std::string(),
const LogFlags & _logFlags = LogFlags(ot::INFORMATION_LOG) )

Dispatch a log message with the provided params. Will forward the created log message object to the dispatch(LogMessage) function. Will apply the current user and project names to the log message before dispatching.

Parameters
_textThe message text.
_functionNameThe name of the function.
_logFlagsThe flags that should be set for the log message.

◆ forgetReceiver()

void ot::LogDispatcher::forgetReceiver ( AbstractLogNotifier * _receiver)

◆ getProjectName()

const std::string & ot::LogDispatcher::getProjectName ( void ) const
inline

◆ getUserName()

const std::string & ot::LogDispatcher::getUserName ( void ) const
inline

◆ initialize()

ot::LogDispatcher & ot::LogDispatcher::initialize ( const std::string & _serviceName,
bool _addCoutReceiver = false )
static

◆ instance()

ot::LogDispatcher & ot::LogDispatcher::instance ( void )
static

◆ logFlags()

LogFlags ot::LogDispatcher::logFlags ( void ) const
inline

◆ mayLog()

static bool ot::LogDispatcher::mayLog ( LogFlag _flags)
inlinestatic

◆ serviceName()

const std::string & ot::LogDispatcher::serviceName ( void ) const
inline

◆ setLogFlag()

void ot::LogDispatcher::setLogFlag ( LogFlag _flag,
bool _active = true )
inline

◆ setLogFlags()

void ot::LogDispatcher::setLogFlags ( LogFlags _flags)
inline

◆ setProjectName()

void ot::LogDispatcher::setProjectName ( const std::string & _name)
inline

◆ setServiceName()

void ot::LogDispatcher::setServiceName ( const std::string & _name)
inline

◆ setUserName()

void ot::LogDispatcher::setUserName ( const std::string & _name)
inline

◆ ~LogDispatcher()

ot::LogDispatcher::~LogDispatcher ( )
privatevirtual

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