Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

RS::LogStream Class Reference

Used to output logging info to a stream. More...

List of all members.

Public Member Functions

 ~LogStream ()
 The destructor.

LogStream & setCurrentArea (const LogAreaName &area)
 Set the current area of logging.

LogAreaName getCurrentArea () const
 Get the current area of logging.

LogStream & setTemporaryArea (const LogAreaName &area)
 Set the current area, temporarily, of logging.

LogStream & resetTemporaryArea ()
 Resets the current area to the area used before the temporary area.

LogStream & stopLogFileArea (const LogAreaName &area)
 Stop printing log info for an area.

LogStream & startLogFileArea (const LogAreaName &area)
 Start printing log info for an area.

LogStream & stopLogScreenArea (const LogAreaName &area)
 Stop printing log info for an area.

LogStream & startLogScreenArea (const LogAreaName &area)
 Start printing log info for an area.

void setAreaFileStream (const LogAreaName &area, std::ostream *os=NULL)
 Set the stream used by a certain area.

std::ostream * getAreaFileStream (const LogAreaName &area)
 Get the stream currently used by a certain area.

void setAreaScreenStream (const LogAreaName &area, std::ostream *os=NULL)
 Set the stream used by a certain area.

std::ostream * getAreaScreenStream (const LogAreaName &area)
 Get the stream currently used by a certain area.

void addLogArea (const LogAreaName &area, const LogAreaName &parent_area=LA_ROBOSOC, const bool do_log_file=true, std::ostream *file_log_stream=NULL, const bool do_log_screen=true, std::ostream *screen_log_stream=NULL)
 Add a new area node to the log area tree.

LogStream & operator<< (LogStream &(*fn)(LogStream &))
 This operator<< is used to call functions by using the << operator.

LogStream & operator<< (std::ostream &(*fn)(std::ostream &))
 This operator<< is used to call functions defined on ostreams by using the LogStream << operator.

LogStream & operator<< (const LogStreamManip &m)
 This operator<< is used to call functions taking an log area name argument by using the << operator.

template<typename T> LogStream & operator<< (const T &thing)
 This template makes it possible to easily output anything to a logstream that you can output to a standard ostream.


Static Public Member Functions

LogStream * instance ()
 LogStream is a singleton, which means that there is only one instance of this class in the system.


Detailed Description

Used to output logging info to a stream.

The class is an implementation of the singleton pattern.

Todo:
The logging to different streams is not very good. A better solution is probably to associate a list of pointers to stream objects that can be iterated over and the message is sent to each of them. The stream object has to know whether it should really log the message or not. In this way as many streams as wanted can be processed at the same time and the interface would become much more uniform.
Unit:
Library
Revision
1.6
Author
s02davro
Date
2002/08/31 14:53:38

Definition at line 101 of file LogStream.h.


Member Function Documentation

LogStream * RS::LogStream::instance   [static]
 

LogStream is a singleton, which means that there is only one instance of this class in the system.

This instance can only be accessed with the LogStream::instance() method, which returns a pointer to the only instance of the class.

Definition at line 85 of file LogStream.cc.

LogStream & RS::LogStream::setTemporaryArea const LogAreaName   area
 

Set the current area, temporarily, of logging.

To return to the current area use ResetTemporaryArea(). What should happen if SetCurrentArea is called after SetTemporaryArea?

Definition at line 147 of file LogStream.cc.

References setCurrentArea().

void RS::LogStream::addLogArea const LogAreaName   area,
const LogAreaName   parent_area = LA_ROBOSOC,
const bool    do_log_file = true,
std::ostream *    file_log_stream = NULL,
const bool    do_log_screen = true,
std::ostream *    screen_log_stream = NULL
 

Add a new area node to the log area tree.

If the area already exist then it will be overwritten.

Definition at line 231 of file LogStream.cc.

References setCurrentArea().

LogStream & RS::LogStream::operator<< LogStream &(*    fn)(LogStream &) [inline]
 

This operator<< is used to call functions by using the << operator.

Ex. log_stream << resetTemporaryArea;

Definition at line 57 of file LogStream.icc.

LogStream & RS::LogStream::operator<< std::ostream &(*    fn)(std::ostream &)
 

This operator<< is used to call functions defined on ostreams by using the LogStream << operator.

Ex. log_stream << std::endl;

Definition at line 245 of file LogStream.cc.

LogStream & RS::LogStream::operator<< const LogStreamManip   m [inline]
 

This operator<< is used to call functions taking an log area name argument by using the << operator.

Ex. log_stream << setTemporaryArea(skill_area);

Definition at line 63 of file LogStream.icc.

References RS::LogStreamManip::area, and RS::LogStreamManip::f.


The documentation for this class was generated from the following files:
Generated on Mon Aug 29 08:22:29 2011 for RoboSoc by doxygen1.3-rc3