cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches

General purposes logger. More...

#include <CepGen/Utils/Logger.h>

Public Types

enum class  Level {
  nothing = 0 , error , warning , information ,
  debug , debugInsideLoop
}
 Logging threshold for the output stream. More...
 
typedef std::unique_ptr< std::ostream, std::function< void(std::ostream *)> > StreamHandler
 

Public Member Functions

void addExceptionRule (const std::string &rule)
 Add a new rule to display exceptions/messages.
 
const std::vector< std::regex > & exceptionRules () const
 Collection of logging exceptions.
 
bool passExceptionRule (const std::string &tmpl, const Level &lev) const
 Is the module set to be displayed/logged?
 
Level level () const
 Logging threshold.
 
void setLevel (Level level)
 Set the logging threshold.
 
bool extended () const
 Also show extended information?
 
void setExtended (bool ext=true)
 Set the extended information flag.
 
bool isTTY () const
 Is the stream handled a TTY-like stream?
 
StreamHandleroutput ()
 Output stream to use for all logging operations.
 
void setOutput (std::ostream *)
 Set the output stream.
 

Static Public Member Functions

static Loggerget (std::ostream *=nullptr)
 Retrieve the running instance of the logger.
 

Detailed Description

Author
Laurent Forthomme laure.nosp@m.nt.f.nosp@m.ortho.nosp@m.mme@.nosp@m.cern..nosp@m.ch
Date
15 Oct 2015

Definition at line 30 of file Logger.h.

Member Typedef Documentation

◆ StreamHandler

typedef std::unique_ptr<std::ostream, std::function<void(std::ostream*)> > StreamHandler

Definition at line 41 of file Logger.h.

Member Enumeration Documentation

◆ Level

enum class Level
strong
Enumerator
nothing 
error 
warning 
information 
debug 
debugInsideLoop 

Definition at line 44 of file Logger.h.

Member Function Documentation

◆ addExceptionRule()

void addExceptionRule ( const std::string &  rule)
Parameters
[in]ruleRegex rule to handle

Definition at line 37 of file Logger.cpp.

◆ exceptionRules()

const std::vector< std::regex > & exceptionRules ( ) const

Definition at line 39 of file Logger.h.

◆ extended()

bool extended ( ) const

Definition at line 54 of file Logger.h.

◆ get()

Logger & get ( std::ostream *  os = nullptr)
static

Definition at line 31 of file Logger.cpp.

◆ isTTY()

bool isTTY ( ) const

Definition at line 65 of file Logger.cpp.

◆ level()

Level level ( ) const

Definition at line 50 of file Logger.h.

◆ output()

Logger::StreamHandler & output ( )

Definition at line 58 of file Logger.cpp.

◆ passExceptionRule()

bool passExceptionRule ( const std::string &  tmpl,
const Level lev 
) const
Parameters
[in]tmplModule name to probe
[in]levUpper verbosity level

Definition at line 41 of file Logger.cpp.

◆ setExtended()

void setExtended ( bool  ext = true)

Definition at line 56 of file Logger.h.

◆ setLevel()

void setLevel ( Level  level)

Definition at line 52 of file Logger.h.

◆ setOutput()

void setOutput ( std::ostream *  os)

Definition at line 56 of file Logger.cpp.