Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Log Class Reference

#include <Logging.hh>

List of all members.


Public Types

typedef map< const string,
Log * > 
LogMap
 Typedef for a collection of named logs.
typedef map< const string,
Level
LevelMap
 Typedef for a collection of named log levels.
enum  Level {
  TRACE = 0, DEBUG = 10, INFO = 20, WARN = 30,
  ERROR = 40
}
 Log priority levels. More...

Public Member Functions

Level getLevel () const
 Get the priority level of this logger.
LogsetLevel (const Level &level)
 Set the priority level of this logger.
string getName () const
 Get the name of this logger.
LogsetName (const string &name)
 Set the name of this logger.
bool isActive (const Level &level) const
 Will this log level produce output on this logger at the moment?
Explicit log methods
void trace (const string &message)
void debug (const string &message)
void info (const string &message)
void warn (const string &message)
void error (const string &message)

Static Public Member Functions

void setDefaultLevels (const LevelMap &logLevels)
 Set the default log levels.
void setShowTimestamp (const bool showTime=true)
void setShowLevel (const bool showLevel=true)
void setShowLoggerName (const bool showName=true)
LoggetLog (const string &name)
 Copy assignment operator.
LoggetLog (const string &name, const Level &level)
 Get a logger with the given name and level.
Level getLevelFromName (const string &level)
 Get a log level enum from a string.
string getLevelName (const Level &level)
 Get the string representation of a log level.

Public Attributes

ostream *const _nostream

Protected Member Functions

void log (const Level &level, const string &message)
 Write a message at a particular level.
string formatMessage (const Level &level, const string &message)
 Turn a message string into the current log format.
Hidden constructors etc.
 Log (const string &name)
 Constructor 1.
 Log (const string &name, const Level &level)
 Constructor 2.

Friends

ostream & operator<< (Log &log, const Log::Level &level)
 The streaming operator can use Log's internals.

Member Typedef Documentation

typedef map<const string, Level> LevelMap
 

Typedef for a collection of named log levels.

Definition at line 22 of file Logging.hh.

Referenced by Rivet::Commandline::useLoggingArgs().

typedef map<const string, Log*> LogMap
 

Typedef for a collection of named logs.

Definition at line 19 of file Logging.hh.


Member Enumeration Documentation

enum Level
 

Log priority levels.

Enumeration values:
TRACE 
DEBUG 
INFO 
WARN 
ERROR 

Definition at line 14 of file Logging.hh.

Referenced by Log::getLog().


Constructor & Destructor Documentation

Log const string &  name  )  [protected]
 

Constructor 1.

Definition at line 16 of file Logging.cc.

Referenced by Log::getLog().

Log const string &  name,
const Level level
[protected]
 

Constructor 2.

Definition at line 20 of file Logging.cc.


Member Function Documentation

void debug const string &  message  )  [inline]
 

Definition at line 121 of file Logging.hh.

Referenced by main().

void error const string &  message  )  [inline]
 

Definition at line 127 of file Logging.hh.

string formatMessage const Level level,
const string &  message
[protected]
 

Turn a message string into the current log format.

Definition at line 91 of file Logging.cc.

References Log::getName().

Referenced by Log::log(), and Rivet::operator<<().

Level getLevel  )  const [inline]
 

Get the priority level of this logger.

Definition at line 85 of file Logging.hh.

Log::Level getLevelFromName const string &  level  )  [static]
 

Get a log level enum from a string.

Definition at line 81 of file Logging.cc.

string getLevelName const Level level  )  [static]
 

Get the string representation of a log level.

Definition at line 64 of file Logging.cc.

References Log::DEBUG, Log::ERROR, Log::INFO, Log::TRACE, and Log::WARN.

Log & getLog const string &  name,
const Level level
[static]
 

Get a logger with the given name and level.

Definition at line 55 of file Logging.cc.

References Log::Log().

Log & getLog const string &  name  )  [static]
 

Copy assignment operator.

Get a logger with the given name. The level will be taken from the "requestedLevels" static map or will be INFO by default.

Definition at line 24 of file Logging.cc.

References Log::Level, and Log::Log().

Referenced by Projection::getLog(), and main().

string getName  )  const [inline]
 

Get the name of this logger.

Definition at line 102 of file Logging.hh.

Referenced by Log::formatMessage().

void info const string &  message  )  [inline]
 

Definition at line 123 of file Logging.hh.

Referenced by main().

bool isActive const Level level  )  const [inline]
 

Will this log level produce output on this logger at the moment?

Definition at line 113 of file Logging.hh.

Referenced by Log::log(), Rivet::operator<<(), VetoedFinalState::project(), and TrackJet::project().

void log const Level level,
const string &  message
[protected]
 

Write a message at a particular level.

Definition at line 117 of file Logging.cc.

References Log::formatMessage(), and Log::isActive().

void setDefaultLevels const LevelMap logLevels  )  [inline, static]
 

Set the default log levels.

Definition at line 42 of file Logging.hh.

Referenced by main().

Log& setLevel const Level level  )  [inline]
 

Set the priority level of this logger.

Definition at line 90 of file Logging.hh.

Log& setName const string &  name  )  [inline]
 

Set the name of this logger.

Definition at line 107 of file Logging.hh.

void setShowLevel const bool  showLevel = true  )  [inline, static]
 

Definition at line 50 of file Logging.hh.

void setShowLoggerName const bool  showName = true  )  [inline, static]
 

Definition at line 54 of file Logging.hh.

void setShowTimestamp const bool  showTime = true  )  [inline, static]
 

Definition at line 46 of file Logging.hh.

void trace const string &  message  )  [inline]
 

Definition at line 119 of file Logging.hh.

void warn const string &  message  )  [inline]
 

Definition at line 125 of file Logging.hh.

Referenced by main().


Friends And Related Function Documentation

ostream& operator<< Log log,
const Log::Level level
[friend]
 

The streaming operator can use Log's internals.

Definition at line 94 of file testNewLogging.cc.


Member Data Documentation

ostream* const _nostream
 

A null output stream, used for piping discarded output to nowhere.

Todo:
Hide this...

Definition at line 148 of file Logging.hh.

Referenced by Rivet::operator<<().


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