Log Class Reference

Ratpac-two: RAT::Log Class Reference
Ratpac-two

Public Types

enum  Level { WARN = 0 , INFO = 1 , DETAIL = 2 , DEBUG = 3 }
 

Static Public Member Functions

static bool Init (std::string _filename, Level display=INFO, Level log=DETAIL)
 
static int GetDisplayLevel ()
 
static void SetDisplayLevel (Level level)
 
static int GetLogLevel ()
 
static void SetLogLevel (Level level)
 
static void Die (std::string message, int return_code=1)
 
static void Assert (bool condition, std::string message, int return_code=1)
 
static const std::string GetLogBuffer ()
 
static void AddMacro (const std::string &contents)
 
static const std::string & GetMacro ()
 
static void AddObject (const std::string &name, TObject *obj)
 
static std::vector< std::pair< std::string, TObject * > > GetObjects ()
 
static void SetDBTraceState (bool state=true)
 
static bool GetDBTraceState ()
 
static void TraceDBAccess (const std::string &table, const std::string &index, const std::string &field, int value)
 
static void TraceDBAccess (const std::string &table, const std::string &index, const std::string &field, double value)
 
static void TraceDBAccess (const std::string &table, const std::string &index, const std::string &field, const std::string &value)
 
static void TraceDBAccess (const std::string &table, const std::string &index, const std::string &field, const std::vector< int > &value)
 
static void TraceDBAccess (const std::string &table, const std::string &index, const std::string &field, const std::vector< double > &value)
 
static void TraceDBAccess (const std::string &table, const std::string &index, const std::string &field, const std::vector< std::string > &value)
 
static void TraceDBAccess (const std::string &table, const std::string &index, const std::string &field, const json::Value &value)
 
static TMap * GetDBTraceMap ()
 

Protected Member Functions

 Log ()
 

Static Protected Member Functions

static void AddDBEntry (const std::string &key, const std::string &value)
 Inline functions. More...
 
static void SetupIO ()
 
static void ClearOMText (omtext *out)
 

Static Protected Attributes

static omtextoutstreams [4] = {&warn, &info, &detail, &debug}
 
static std::string filename
 
static oftext logfile
 
static int display_level = Log::DEBUG
 
static int log_level = Log::DETAIL
 
static std::string macro
 
static bool enable_dbtrace = false
 
static TMap * dbtrace = 0
 
static std::vector< std::pair< std::string, TObject * > > objects
 

Member Enumeration Documentation

◆ Level

Verbosity levels

Enumerator
WARN 

Warning messages

INFO 

Short informational messages

DETAIL 

Longer messages related to settings and normal operation

DEBUG 

Messages only of use to troubleshoot broken code

Constructor & Destructor Documentation

◆ Log()

Log::Log ( )
protected

This class cannot be instantiated.

Member Function Documentation

◆ AddDBEntry()

void Log::AddDBEntry ( const std::string &  key,
const std::string &  value 
)
inlinestaticprotected

Inline functions.

Add a string key/value pair to the dbtrace map

◆ AddMacro()

static void RAT::Log::AddMacro ( const std::string &  contents)
inlinestatic

Add macro commands to buffer. Don't forget newlines!

◆ AddObject()

static void RAT::Log::AddObject ( const std::string &  name,
TObject *  obj 
)
inlinestatic

Log a TObject. Do not delete this pointer after you log it!

◆ Assert()

void Log::Assert ( bool  condition,
std::string  message,
int  return_code = 1 
)
static

Write message to warn stream and immediately terminate if @condition is not true. return_code is returned to the OS to signal job failure

◆ ClearOMText()

void Log::ClearOMText ( omtext out)
staticprotected

Utility function to remove all output streams from an omtext object.

◆ Die()

void Log::Die ( std::string  message,
int  return_code = 1 
)
static

Write message to warn stream and immediately terminate, sending return_code back to OS.

◆ GetDBTraceState()

static bool RAT::Log::GetDBTraceState ( )
inlinestatic

Get current DB tracing state.

◆ GetDisplayLevel()

static int RAT::Log::GetDisplayLevel ( )
inlinestatic

Get the current verbosity level for display on screen.

◆ GetLogBuffer()

const std::string Log::GetLogBuffer ( )
static

Return reference to string containing entire log from this session

◆ GetLogLevel()

static int RAT::Log::GetLogLevel ( )
inlinestatic

Get the current verbosity level for writing to log file

◆ GetMacro()

static const std::string& RAT::Log::GetMacro ( )
inlinestatic

Get the macro commands that have been run so far

◆ GetObjects()

static std::vector<std::pair<std::string, TObject *> > RAT::Log::GetObjects ( )
inlinestatic

Get an array of logged TObjects. Should be used by output processors just before closing their output file.

◆ Init()

bool Log::Init ( std::string  _filename,
Level  display = INFO,
Level  log = DETAIL 
)
static

Initialize the logging system.

Parameters
_filenameName of log file to open for writing.
displayVerbosity level for display on screen
logVerbosity level for writing to log file.

◆ SetDBTraceState()

static void RAT::Log::SetDBTraceState ( bool  state = true)
inlinestatic

Enable/Disable tracing of RATDB accesses.

AddDBAccess() does nothing if tracing is disabled (default)

◆ SetDisplayLevel()

void Log::SetDisplayLevel ( Level  level)
static

Set verbosity level for display on screen.

◆ SetLogLevel()

void Log::SetLogLevel ( Level  level)
static

Set verbosity level for writing to log file.

◆ SetupIO()

void Log::SetupIO ( )
staticprotected

Reset output streams to according to verbosity levels.

Call this method after changing display_level or log_level to update where warn, info, detail, debug send messages.

◆ TraceDBAccess() [1/7]

void Log::TraceDBAccess ( const std::string &  table,
const std::string &  index,
const std::string &  field,
const json::Value value 
)
inlinestatic

Add a RATDB JSON object access to the DB trace.

◆ TraceDBAccess() [2/7]

void Log::TraceDBAccess ( const std::string &  table,
const std::string &  index,
const std::string &  field,
const std::string &  value 
)
inlinestatic

Add a RATDB string access to the DB trace.

◆ TraceDBAccess() [3/7]

void Log::TraceDBAccess ( const std::string &  table,
const std::string &  index,
const std::string &  field,
const std::vector< double > &  value 
)
inlinestatic

Add a RATDB double array access to the DB trace.

◆ TraceDBAccess() [4/7]

void Log::TraceDBAccess ( const std::string &  table,
const std::string &  index,
const std::string &  field,
const std::vector< int > &  value 
)
inlinestatic

Add a RATDB integer array access to the DB trace.

◆ TraceDBAccess() [5/7]

void Log::TraceDBAccess ( const std::string &  table,
const std::string &  index,
const std::string &  field,
const std::vector< std::string > &  value 
)
inlinestatic

Add a RATDB string access to the DB trace.

◆ TraceDBAccess() [6/7]

void Log::TraceDBAccess ( const std::string &  table,
const std::string &  index,
const std::string &  field,
double  value 
)
inlinestatic

Add a RATDB double access to the DB trace.

◆ TraceDBAccess() [7/7]

void Log::TraceDBAccess ( const std::string &  table,
const std::string &  index,
const std::string &  field,
int  value 
)
inlinestatic

Add a RATDB integer access to the DB trace.

Member Data Documentation

◆ dbtrace

TMap * Log::dbtrace = 0
staticprotected

Record of all accessed RATDB fields

◆ display_level

int Log::display_level = Log::DEBUG
staticprotected

Current display verbosity

◆ enable_dbtrace

bool Log::enable_dbtrace = false
staticprotected

Enable RATDB tracing?

◆ filename

std::string Log::filename
staticprotected

Name of log file.

◆ log_level

int Log::log_level = Log::DETAIL
staticprotected

Current log file verbsoity

◆ logfile

oftext Log::logfile
staticprotected

Log file object

◆ macro

std::string Log::macro
staticprotected

Buffer of macro commands run so far

◆ objects

std::vector< std::pair< std::string, TObject * > > Log::objects
staticprotected

Record of logged TObjects

◆ outstreams

omtext * Log::outstreams = {&warn, &info, &detail, &debug}
staticprotected

Pointers to global output streams in order of verbosity.


The documentation for this class was generated from the following files:
  • /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/core/include/RAT/Log.hh
  • /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/core/src/Log.cc