ARC SDK
Public Member Functions
Arc::LogStream Class Reference

A class for logging to ostreams. More...

#include <arc/Logger.h>

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

Public Member Functions

 LogStream (std::ostream &destination)
 Creates a LogStream connected to an ostream. More...
 
virtual void log (const LogMessage &message)
 Writes a LogMessage to the stream. More...
 
- Public Member Functions inherited from Arc::LogDestination
void setFormat (const LogFormat &newformat)
 Set format for this log destination. More...
 
void setPrefix (const std::string &prefix)
 Set a prefix for this log destination to be logged before messages. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Arc::LogDestination
 LogDestination ()
 Default constructor. Protected since subclasses should be used instead. More...
 
- Protected Attributes inherited from Arc::LogDestination
LogFormat format
 Format to use in this LogDestination. More...
 
std::string prefix
 Prefix to use in this log destination. More...
 

Detailed Description

A class for logging to ostreams.

This class is used for logging to ostreams (cout, cerr, files). It provides synchronization in order to prevent different LogMessages to appear mixed with each other in the stream. In order not to break the synchronization, LogStreams should never be copied. Therefore the copy constructor and assignment operator are private. Furthermore, it is important to keep a LogStream object as long as the Logger to which it has been registered.

Constructor & Destructor Documentation

Arc::LogStream::LogStream ( std::ostream &  destination)

Creates a LogStream connected to an ostream.

Creates a LogStream connected to the specified ostream. In order not to break synchronization, it is important not to connect more than one LogStream object to a certain stream.

Parameters
destinationThe ostream to which to write LogMessages.

Member Function Documentation

virtual void Arc::LogStream::log ( const LogMessage message)
virtual

Writes a LogMessage to the stream.

This method writes a LogMessage to the ostream that is connected to this LogStream object. It is synchronized so that not more than one LogMessage can be written at a time.

Parameters
messageThe LogMessage to write.

Implements Arc::LogDestination.


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