rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.2

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.
 

Public Member Functions

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 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)
 
void critical (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 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.
 

Static Public Attributes

static const int END_COLOR = -10
 Special "level-like" code to end coloring.
 

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)
 Get the TTY code string for coloured messages.
 

Friends

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(), Rivet::Cutflow::getLog(), Rivet::HistoGroup< GroupAxisT, AxisT >::getLog(), and Rivet::RivetONNXrt::getLog().


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