interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

VUtil::Log Class Reference

#include <vos/vos/log.hh>

List of all members.


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 as well as you can set properties of individual channels.

Definition at line 164 of file log.hh.

Public Member Functions

Static Public Member Functions

Static Public Attributes

Classes


Constructor & Destructor Documentation

VUtil::Log::Log ( const std::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.

VUtil::Log::Log ( const std::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.


Member Function Documentation

static void VUtil::Log::addChannel ( Log l  )  [static]

Add a new channel to the channel table.

Parameters:
l the log channel

static int VUtil::Log::getDefaultLevel (  )  [static]

Returns the default log level for new log channels.

int VUtil::Log::getLevel (  ) 

Get the log level for this channel.

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

static Log* VUtil::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

static Log* VUtil::Log::getLog ( const std::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

static int VUtil::Log::getMasterLevel (  )  [static]

Returns the master log level.

static void VUtil::Log::log ( const std::string &  channel,
int  level,
const std::string &  message 
) [static]

static void VUtil::Log::log ( const char *  channel,
int  level,
const std::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 std::string to print

For internal use only.

void VUtil::Log::log ( int  level,
const std::string &  message 
)

Write a line to the log stream.

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 std::string to print

For internal use only.

static void VUtil::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.

static void VUtil::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.

static void VUtil::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

void VUtil::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 "channel1=level1,channel1=level1,..." -- where 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.

static void VUtil::Log::setLevelForAllChannels ( int  level  )  [static]

Sets the log level for all channels and make this the new default log level.

static void VUtil::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.

static void VUtil::Log::setStreamForAllChannels ( std::ostream *  o  )  [static]

Redirect all existing channels to use the supplied output stream and make this stream the default output stream.


Member Data Documentation

A level that applies to all channels.

(default is 10)

Definition at line 190 of file log.hh.


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