Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
EDepSim::LogManager Class Reference

#include <EDepSimLog.hh>

Public Types

enum  ErrorPriority {
  SilentLevel, ErrorLevel, SevereLevel, WarnLevel,
  DebugLevel, TraceLevel
}
 
enum  LogPriority { QuietLevel, LogLevel, InfoLevel, VerboseLevel }
 

Public Member Functions

 ~LogManager ()
 

Static Public Member Functions

static void Configure (const char *conf=NULL)
 
static void SetDebugStream (std::ostream *err)
 Set the output stream to be used for error messages. More...
 
static void SetDebugLevel (ErrorPriority level)
 
static void SetDebugLevel (const char *trace, ErrorPriority level)
 Set the debugging level for a particular trace. More...
 
static ErrorPriority GetDebugLevel ()
 Get the current debugging level;. More...
 
static ErrorPriority GetDebugLevel (const char *trace)
 Get the current debugging level for a named trace. More...
 
static void SetLogStream (std::ostream *log)
 Set the output stream to be used for log messages. More...
 
static void SetLogLevel (LogPriority level)
 Set the default logging level. More...
 
static void SetLogLevel (const char *trace, LogPriority level)
 Set the logging level for a named trace. More...
 
static LogPriority GetLogLevel ()
 Get the current logging level;. More...
 
static LogPriority GetLogLevel (const char *trace)
 Get the current logging level;. More...
 
static std::ostream & GetDebugStream ()
 Return the stream associated with the error file. More...
 
static std::ostream & GetLogStream ()
 Return the stream associated with the log file. More...
 
static void SetIndentation (int i)
 Set the indentation level for a log message. More...
 
static void IncreaseIndentation ()
 Increase the indentation level. More...
 
static void DecreaseIndentation ()
 Decrease the indentation level. More...
 
static void ResetIndentation ()
 Reset the indentation to zero. More...
 
static std::string MakeIndent ()
 [Internal method] Make an indentation for a log message. More...
 

Private Member Functions

 LogManager ()
 

Static Private Attributes

static ErrorPriority fErrorPriority = EDepSim::LogManager::ErrorLevel
 
static LogPriority fLogPriority = EDepSim::LogManager::LogLevel
 
static std::ostream * fDebugStream = NULL
 
static std::ostream * fLogStream = NULL
 
static std::map< std::string, ErrorPriorityfErrorTraces
 
static std::map< std::string, LogPriorityfLogTraces
 
static int fIndentation = 0
 

Detailed Description

Definition at line 380 of file EDepSimLog.hh.

Member Enumeration Documentation

Constructor & Destructor Documentation

EDepSim::LogManager::~LogManager ( )

Definition at line 16 of file EDepSimLogManager.cc.

16 { }
EDepSim::LogManager::LogManager ( )
inlineprivate

Definition at line 467 of file EDepSimLog.hh.

467 { }

Member Function Documentation

void EDepSim::LogManager::Configure ( const char *  conf = NULL)
static

Cause the logging and error output streams to be initialized. Basic configuration for logging occurs automatically, so this need not be called. If this is called, then it first trys to read the edeplog.config file in the current directory. If Configure is called with an argument, then the named file will be read after reading the local configuration file. If Configure is called with a named file then that file must exist. The The EDepSim::LogManager Configuration File syntax is described elsewhere.

Definition at line 387 of file EDepSimLogManager.cc.

387  {
388  // Try to read a local configuration file.
389  ReadConfigurationFile("./edeplog.config");
390  if (conf) {
391  bool success = ReadConfigurationFile(conf);
392  if (!success) EDepSimLog("EDepSim::Log configuration file was not read.");
393  }
394 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
Definition: conf.py:1
void EDepSim::LogManager::DecreaseIndentation ( )
static

Decrease the indentation level.

Definition at line 115 of file EDepSimLogManager.cc.

static ErrorPriority EDepSim::LogManager::GetDebugLevel ( )
inlinestatic

Get the current debugging level;.

Definition at line 417 of file EDepSimLog.hh.

417 {return fErrorPriority;}
static ErrorPriority fErrorPriority
Definition: EDepSimLog.hh:459
EDepSim::LogManager::ErrorPriority EDepSim::LogManager::GetDebugLevel ( const char *  trace)
static

Get the current debugging level for a named trace.

Definition at line 23 of file EDepSimLogManager.cc.

23  {
25  if (elem == fErrorTraces.end()) return fErrorPriority;
26  return elem->second;
27 }
intermediate_table::iterator iterator
static ErrorPriority fErrorPriority
Definition: EDepSimLog.hh:459
static std::map< std::string, ErrorPriority > fErrorTraces
Definition: EDepSimLog.hh:463
M::value_type trace(const M &m)
std::ostream & EDepSim::LogManager::GetDebugStream ( )
static

Return the stream associated with the error file.

Definition at line 68 of file EDepSimLogManager.cc.

68  {
71 }
static std::ostream & GetLogStream()
Return the stream associated with the log file.
static std::ostream * fDebugStream
Definition: EDepSimLog.hh:461
static LogPriority EDepSim::LogManager::GetLogLevel ( )
inlinestatic

Get the current logging level;.

Definition at line 432 of file EDepSimLog.hh.

432 {return fLogPriority;}
static LogPriority fLogPriority
Definition: EDepSimLog.hh:460
EDepSim::LogManager::LogPriority EDepSim::LogManager::GetLogLevel ( const char *  trace)
static

Get the current logging level;.

Definition at line 78 of file EDepSimLogManager.cc.

78  {
80  if (elem == fLogTraces.end()) return fLogPriority;
81  return elem->second;
82 }
intermediate_table::iterator iterator
static std::map< std::string, LogPriority > fLogTraces
Definition: EDepSimLog.hh:464
static LogPriority fLogPriority
Definition: EDepSimLog.hh:460
M::value_type trace(const M &m)
std::ostream & EDepSim::LogManager::GetLogStream ( )
static

Return the stream associated with the log file.

Definition at line 102 of file EDepSimLogManager.cc.

102  {
103  if (!EDepSim::LogManager::fLogStream) return std::cout;
105 }
static std::ostream * fLogStream
Definition: EDepSimLog.hh:462
void EDepSim::LogManager::IncreaseIndentation ( )
static

Increase the indentation level.

Definition at line 111 of file EDepSimLogManager.cc.

111  {
113 }
static int fIndentation
Definition: EDepSimLog.hh:465
std::string EDepSim::LogManager::MakeIndent ( )
static

[Internal method] Make an indentation for a log message.

Definition at line 124 of file EDepSimLogManager.cc.

124  {
125  if (fIndentation<1) return "";
126  std::string indent = "";
127  for (int i=0; i<fIndentation; ++i) {
128  indent += "..";
129  }
130  indent += " ";
131  return indent;
132 }
std::string string
Definition: nybbler.cc:12
static int fIndentation
Definition: EDepSimLog.hh:465
void EDepSim::LogManager::ResetIndentation ( )
static

Reset the indentation to zero.

Definition at line 119 of file EDepSimLogManager.cc.

119  {
121 }
static int fIndentation
Definition: EDepSimLog.hh:465
static void EDepSim::LogManager::SetDebugLevel ( ErrorPriority  level)
inlinestatic

Set the default debugging level. The level parameter takes a value with type EDepSim::LogManager::ErrorPriority.

Definition at line 411 of file EDepSimLog.hh.

void EDepSim::LogManager::SetDebugLevel ( const char *  trace,
ErrorPriority  level 
)
static

Set the debugging level for a particular trace.

Definition at line 18 of file EDepSimLogManager.cc.

19  {
21 }
static std::map< std::string, ErrorPriority > fErrorTraces
Definition: EDepSimLog.hh:463
M::value_type trace(const M &m)
void EDepSim::LogManager::SetDebugStream ( std::ostream *  err)
static

Set the output stream to be used for error messages.

Definition at line 50 of file EDepSimLogManager.cc.

50  {
52  if (!fDebugStream) return;
53  std::ofstream* ofile = dynamic_cast<std::ofstream*>(err);
54  if (ofile && !(ofile->is_open())) {
55  fDebugStream = NULL;
56  EDepSimSevere("Debug stream is not open.");
57  }
59  << "##################################################"
60  << std::endl
61  << "# ERROR LOG STARTS AT: " << MakeTimeStamp()
62  << std::endl
63  << "##################################################"
64  << std::endl
65  << std::endl;
66 }
#define EDepSimSevere(outStream)
Definition: EDepSimLog.hh:539
void err(const char *fmt,...)
Definition: message.cpp:226
static std::ostream * fDebugStream
Definition: EDepSimLog.hh:461
QTextStream & endl(QTextStream &s)
void EDepSim::LogManager::SetIndentation ( int  i)
static

Set the indentation level for a log message.

Definition at line 107 of file EDepSimLogManager.cc.

107  {
109 }
static int max(int a, int b)
static int fIndentation
Definition: EDepSimLog.hh:465
static void EDepSim::LogManager::SetLogLevel ( LogPriority  level)
inlinestatic

Set the default logging level.

Definition at line 426 of file EDepSimLog.hh.

void EDepSim::LogManager::SetLogLevel ( const char *  trace,
LogPriority  level 
)
static

Set the logging level for a named trace.

Definition at line 73 of file EDepSimLogManager.cc.

74  {
76 }
static std::map< std::string, LogPriority > fLogTraces
Definition: EDepSimLog.hh:464
M::value_type trace(const M &m)
void EDepSim::LogManager::SetLogStream ( std::ostream *  log)
static

Set the output stream to be used for log messages.

Definition at line 84 of file EDepSimLogManager.cc.

84  {
86  if (!fLogStream) return;
87  std::ofstream* ofile = dynamic_cast<std::ofstream*>(log);
88  if (ofile && !(ofile->is_open())) {
89  fLogStream = NULL;
90  EDepSimSevere("Log stream is not open.");
91  }
93  << "##################################################"
94  << std::endl
95  << "# LOG STARTS AT: " << MakeTimeStamp()
96  << std::endl
97  << "##################################################"
98  << std::endl
99  << std::endl;
100 }
#define EDepSimSevere(outStream)
Definition: EDepSimLog.hh:539
static std::ostream * fLogStream
Definition: EDepSimLog.hh:462
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::ostream * EDepSim::LogManager::fDebugStream = NULL
staticprivate

Definition at line 461 of file EDepSimLog.hh.

EDepSim::LogManager::ErrorPriority EDepSim::LogManager::fErrorPriority = EDepSim::LogManager::ErrorLevel
staticprivate

Definition at line 459 of file EDepSimLog.hh.

std::map< std::string, EDepSim::LogManager::ErrorPriority > EDepSim::LogManager::fErrorTraces
staticprivate

Definition at line 463 of file EDepSimLog.hh.

int EDepSim::LogManager::fIndentation = 0
staticprivate

Definition at line 465 of file EDepSimLog.hh.

EDepSim::LogManager::LogPriority EDepSim::LogManager::fLogPriority = EDepSim::LogManager::LogLevel
staticprivate

Definition at line 460 of file EDepSimLog.hh.

std::ostream * EDepSim::LogManager::fLogStream = NULL
staticprivate

Definition at line 462 of file EDepSimLog.hh.

std::map< std::string, EDepSim::LogManager::LogPriority > EDepSim::LogManager::fLogTraces
staticprivate

Definition at line 464 of file EDepSimLog.hh.


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