rivet is hosted by Hepforge, IPPP Durham
Rivet 3.1.6

Logging system for controlled & formatted writing to stdout. More...

#include <Logging.hh>

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, LogLogMap
 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.
 

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)
 

Hidden constructors etc.

static LoggetLog (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.
 
 Log (const std::string &name)
 Constructor 1.
 
 Log (const std::string &name, int level)
 Constructor 2.
 
static std::string getColorCode (int level)
 
int getLevel () const
 Get the priority level of this logger.
 
LogsetLevel (int level)
 Set the priority level of this logger.
 
std::string getName () const
 Get the name of this logger.
 
LogsetName (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 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.
 
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)
 
std::ostream & operator<< (Log &log, int level)
 The streaming operator can use Log's internals.
 

Detailed Description

Logging system for controlled & formatted writing to stdout.

Member Function Documentation

◆ getLog()

static 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.

Referenced by Rivet::Projection::getLog().


The documentation for this class was generated from the following file:
  • /Users/chrisg/software/rivet/include/Rivet/Tools/Logging.hh