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

VOS::Log Class Reference

The logging class. More...

#include <vos/corelibs/vos/log.hh>

List of all members.

Public Member Functions

Static Public Member Functions

Static Public Attributes


Detailed Description

The logging class.

The main user interface to this class is the macro LOG(), but you can set some global options using the static methods in this class, and you can set properties of individual channels using this class.

Definition at line 104 of file log.hh.


Constructor & Destructor Documentation

Log::Log const string &  channel,
std::ostream *  outputstream
 

Construct a new logging channel.

Usually you don't need to call this, as it will be created automatically when a new channel is refered to.

Parameters:
channel the channel name that will select this log object
outputstream the output stream this log will write to

For internal use only.

Definition at line 46 of file log.cc.

Referenced by log(), and readEnvironment().

Log::Log const string &  channel  ) 
 

Construct a new logging channel.

Usually you don't need to call this, as it will be created automatically when a new channel is refered to.

Parameters:
channel the channel name that will select this log object

For internal use only.

Definition at line 50 of file log.cc.


Member Function Documentation

void Log::addChannel Log l  )  [static]
 

Add a new channel to the channel table.

Parameters:
l the log channel

Definition at line 90 of file log.cc.

Referenced by readEnvironment().

void Log::closeAllChannels  )  [static]
 

Close all channels.

Definition at line 155 of file log.cc.

int Log::getDefaultLevel  )  [static]
 

Returns the default log level for new log channels.

Definition at line 93 of file log.cc.

int Log::getLevel  ) 
 

Get the log level for this channel.

Returns:
loglevel the level, messages with a level higher than this will be suppressed.

Definition at line 72 of file log.cc.

Log * Log::getLog const char *  channel  )  [static]
 

Obtain the log object for a particular channel.

Parameters:
channel the channel desired.
Returns:
the log object desired, or 0 if it does not exist

Definition at line 101 of file log.cc.

Log * Log::getLog const string &  channel  )  [static]
 

Obtain the log object for a particular channel.

Parameters:
channel the channel desired.
Returns:
the log object desired, or 0 if it does not exist

Definition at line 97 of file log.cc.

Referenced by readEnvironment().

int Log::getMasterLevel  )  [static]
 

Returns the master log level.

Definition at line 95 of file log.cc.

void Log::log const string &  channel,
int  level,
const string &  message
[static]
 

Definition at line 77 of file log.cc.

void Log::log const char *  channel,
int  level,
const string &  message
[static]
 

Log to a particular channel, which will be created if it does not exist.

You probably want to be using LOG(), however.

Parameters:
channel the channel to log in
level the level to log at. If the logging channel level is lower than this level, the log message will be suppressed
message the message string to print

For internal use only.

Definition at line 82 of file log.cc.

void Log::log int  level,
const string &  message
 

Write a line to the logfile.

You probably want to be using LOG(), however.

Parameters:
level the level to log at. If the logging channel level is lower than this level, the log message will be suppressed
message the message string to print

For internal use only.

Definition at line 54 of file log.cc.

Referenced by log().

void Log::readEnvironment  )  [static]
 

Read the environment variable VOS_LOG and set/create the appropriate log channels to the specified levels.

Note:
This is called exactly once automatically by getLog() so you probably don't ever have to call this.

Definition at line 108 of file log.cc.

Referenced by getLog().

void Log::setDefaultLevel int  loglevel  )  [static]
 

Sets the default log level for new log channels.

Parameters:
loglevel the level, messages with a level higher than this will be suppressed.

Definition at line 92 of file log.cc.

Referenced by readEnvironment().

void Log::setDefaultOutputStream std::ostream *  o  )  [static]
 

Sets the default output stream for new log objects.

The starting default output stream is "clog" (which is generally an alias for stderr.)

Parameters:
o the output stream

Definition at line 91 of file log.cc.

void Log::setLevel int  loglevel  ) 
 

Set the log level for this channel.

Log levels for channels can also be set with an environment variable VOS_LOG, which takes the format channel:level,channel:level, etc. -- channel is the name of a log channel, and level is the integer level for that channel.

Parameters:
loglevel the level, messages with a level higher than this will be suppressed.

Definition at line 67 of file log.cc.

Referenced by readEnvironment().

void Log::setMasterLevel int  loglevel  )  [static]
 

Sets the master log level for all log objects.

The master log level applies to all logging statements, regardless of channel name.

Parameters:
loglevel the new level. Messages with a level higher than this will be suppressed.

Definition at line 94 of file log.cc.

Referenced by readEnvironment().


Member Data Documentation

boost::mutex Log::log_io_mutex [static]
 

Definition at line 38 of file log.cc.

Referenced by log().

int Log::masterLogLevel = 10 [static]
 

A level that applies to all channels.

(default is 10)

Definition at line 43 of file log.cc.

Referenced by getMasterLevel(), and setMasterLevel().


The documentation for this class was generated from the following files:
Generated on Tue Aug 12 03:56:04 2003 for Interreality Project - VOS by doxygen 1.3.2