ARC SDK
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
Arc::LogDestination Class Referenceabstract

A base class for log destinations. More...

#include <arc/Logger.h>

Inheritance diagram for Arc::LogDestination:
Arc::LogFile Arc::LogStream

Public Member Functions

virtual void log (const LogMessage &message)=0
 Logs a LogMessage to this LogDestination. More...
 
void setFormat (const LogFormat &newformat)
 Set format for this log destination. More...
 
LogFormat getFormat () const
 Returns currently assigned format. More...
 
void setPrefix (const std::string &prefix)
 Set a prefix for this log destination to be logged before messages. More...
 
std::string getPrefix () const
 Returns currently assignd prefix. More...
 

Static Public Member Functions

static void setDefaultFormat (const LogFormat &newformat)
 Set format for any new log destination. More...
 
static LogFormat getDefaultFormat ()
 Returns currently assigned default format. More...
 

Protected Member Functions

 LogDestination ()
 Default constructor. Protected since subclasses should be used instead. More...
 

Protected Attributes

Glib::Mutex mutex
 A mutex for synchronization. More...
 
LogFormat format
 Format to use in this LogDestination. More...
 
std::string prefix
 Prefix to use in this log destination. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const LogDestination &dest)
 Sets iword and pword for format and prefix. More...
 

Detailed Description

A base class for log destinations.

This class defines an interface for LogDestinations. LogDestination objects will typically contain synchronization mechanisms and should therefore never be copied. If setlocale() has been called with a supported locale, log messages will be logged in that locale.

Constructor & Destructor Documentation

◆ LogDestination()

Arc::LogDestination::LogDestination ( )
protected

Default constructor. Protected since subclasses should be used instead.

Member Function Documentation

◆ getDefaultFormat()

static LogFormat Arc::LogDestination::getDefaultFormat ( )
static

Returns currently assigned default format.

◆ getFormat()

LogFormat Arc::LogDestination::getFormat ( ) const

Returns currently assigned format.

◆ getPrefix()

std::string Arc::LogDestination::getPrefix ( ) const

Returns currently assignd prefix.

◆ log()

virtual void Arc::LogDestination::log ( const LogMessage message)
pure virtual

Logs a LogMessage to this LogDestination.

Implemented in Arc::LogFile, and Arc::LogStream.

◆ setDefaultFormat()

static void Arc::LogDestination::setDefaultFormat ( const LogFormat newformat)
static

Set format for any new log destination.

◆ setFormat()

void Arc::LogDestination::setFormat ( const LogFormat newformat)

Set format for this log destination.

◆ setPrefix()

void Arc::LogDestination::setPrefix ( const std::string &  prefix)

Set a prefix for this log destination to be logged before messages.

The prefix is prepended to messages in all formats except EmptyFormat.

Since
Added in 4.0.0.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const LogDestination dest 
)
friend

Sets iword and pword for format and prefix.

Field Documentation

◆ format

LogFormat Arc::LogDestination::format
protected

Format to use in this LogDestination.

◆ mutex

Glib::Mutex Arc::LogDestination::mutex
mutableprotected

A mutex for synchronization.

This mutex is to be locked before a LogMessage is written and it is not unlocked until the entire message has been written and the stream flushed. This is done in order to prevent LogMessages to appear mixed in the stream and prevent race on modification of internal members. It is mutable to provide protection while reading members.

◆ prefix

std::string Arc::LogDestination::prefix
protected

Prefix to use in this log destination.

Since
Added in 4.0.0.

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