Rivet::Log Class Reference

## Public Types

enum | Level { TRACE = 0, DEBUG = 10, INFO = 20, WARN = 30, WARNING = 30, ERROR = 40, CRITICAL = 50, ALWAYS = 50 }
| Log priority levels.
typedef std::map< std::string, Log * > | LogMap
| Typedef for a collection of named logs.
typedef std::map< std::string, int > | LevelMap
| Typedef for a collection of named log levels.
typedef std::map< int, std::string > | ColorCodes
| Typedef for a collection of shell color codes, accessed by log level.

## Public Member Functions

int | getLevel () const
| Get the priority level of this logger.
Log & | setLevel (int level)
| Set the priority level of this logger.
std::string | getName () const
| Get the name of this logger.
Log & | setName (const std::string &name)
| Set the name of this logger.
bool | isActive (int level) const
| Will this log level produce output on this logger at the moment?
Explicit log methods
void | trace (const std::string &message)
void | debug (const std::string &message)
void | info (const std::string &message)
void | warn (const std::string &message)
void | error (const std::string &message)

## Static Public Member Functions

static void | setLevel (const std::string &name, int level)
| Set the log levels.
static void | setLevels (const LevelMap &logLevels)
static void | setShowTimestamp (bool showTime=true)
static void | setShowLevel (bool showLevel=true)
static void | setShowLoggerName (bool showName=true)
static void | setUseColors (bool useColors=true)
static Log & | getLog (const std::string &name)
static Level | getLevelFromName (const std::string &level)
| Get a log level enum from a string.
static std::string | getLevelName (int level)
| Get the std::string representation of a log level. More...

## Protected Member Functions

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

## Static Protected Member Functions

static std::string | getColorCode (int level)

## Friends

std::ostream & | operator<< (Log &log, int level)
| The streaming operator can use Log's internals.

## Member Function Documentation

## getColorCode()

string Rivet::Log::getColorCode | ( | int | level | ) |

static protected

Todo:
  Test for VT100 compliance?

Todo:
  Do the map::upper_limit thing to find nearest level...

Referenced by formatMessage().

## getLevelName()

string Rivet::Log::getLevelName | ( | int | level | ) |

static

Get the std::string representation of a log level.

Todo:
  Do the map::upper_limit thing to find nearest level...

Referenced by formatMessage(), and setLevel().

## getLog()

Log & Rivet::Log::getLog | ( | const std::string & | name | ) |

static

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

References Log().

Referenced by Rivet::ProjectionApplier::applyProjection(), Rivet::ProjectionHandler::getInstance(), Rivet::Projection::getLog(), Rivet::Analysis::getLog(), Rivet::Run::init(), Rivet::Run::openFile(), Rivet::Run::processEvent(), Rivet::Run::readEvent(), and Rivet::AnalysisHandler::~AnalysisHandler().

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

- include/Rivet/Tools/Logging.hh
- src/Tools/Logging.cc