bes
Updated for version 3.17.0
|
Provides a mechanism for applications to log information to an external file. More...
#include <BESLog.h>
Public Types | |
typedef std::ios &(* | p_ios_manipulator) (std::ios &) |
Defines a data type p_ios_manipulator "pointer to function that takes ios& and returns ios&". | |
typedef std::ostream &(* | p_ostream_manipulator) (std::ostream &) |
Defines a data type p_std::ostream_manipulator "pointer to function that takes std::ostream& and returns std::ostream&". | |
Public Member Functions | |
virtual void | dump (std::ostream &strm) const |
dumps information about this object More... | |
std::ostream * | get_log_ostream () |
bool | is_verbose () |
Returns true if verbose logging is requested. More... | |
BESLog & | operator<< (std::string &) |
Overloaded inserter that writes the specified string. More... | |
BESLog & | operator<< (const std::string &) |
Overloaded inserter that writes the specified const string. More... | |
BESLog & | operator<< (char *) |
Overloaded inserter that writes the specified char *. More... | |
BESLog & | operator<< (const char *) |
Overloaded inserter that writes the specified const char *. More... | |
BESLog & | operator<< (int) |
Overloaded inserter that writes the specified int value. More... | |
BESLog & | operator<< (char) |
Overloaded inserter that writes the specified char value. More... | |
BESLog & | operator<< (long) |
Overloaded inserter that writes the specified long value. More... | |
BESLog & | operator<< (unsigned long) |
Overloaded inserter that writes the specified unsigned long value. More... | |
BESLog & | operator<< (double) |
Overloaded inserter that writes the specified double value. More... | |
BESLog & | operator<< (p_ostream_manipulator) |
Overloaded inserter that takes stream manipulation methods. More... | |
BESLog & | operator<< (p_ios_manipulator) |
Overloaded inserter that takes ios methods. More... | |
void | resume () |
Resumes logging after being suspended. More... | |
void | suspend () |
Suspend logging of any information until resumed. More... | |
void | verbose_off () |
turns off verbose logging More... | |
void | verbose_on () |
turn on verbose logging More... | |
~BESLog () | |
Cleans up the logging mechanism. More... | |
Static Public Member Functions | |
static BESLog * | TheLog () |
Protected Member Functions | |
BESLog () | |
constructor that sets up logging for the application. More... | |
void | dump_time () |
Protected method that dumps the date/time to the log file. More... | |
BESLog provides a mechanism for applications to log information to an external file, such as debugging information. This file is defined in the BESKeys mechanism using the key BES.LogName.
Also provides a mechanism to define whether debugging information should be verbose or not using the BESKeys key/value pair BES.LogVerbose.
Logging can also be suspended and resumed using so named methods.
BESLog is used similar to cerr and cout using the overloaded operator <<.
if( BESLog::TheLog()->is_verbose() ) { *(BESLog::TheLog()) << "This is some information to be logged" << endl ; }
Types of data that can be logged include:
BESLog provides a static method for access to a single BESLog object, TheLog.
|
protected |
Sets up logging for the application by opening up the logging file and determining verbose logging.
The file name is determined using the BESKeys mechanism. The key used is BES.LogName. The application must be able to write to this directory/file.
Verbose logging is determined also using the BESKeys mechanism. The key used is BES.LogVerbose.
BESInternalError | if BESLogName is not set or if there are problems opening or writing to the log file. |
Definition at line 66 of file BESLog.cc.
References BESKeys::get_value(), and TheBESKeys::TheKeys().
BESLog::~BESLog | ( | ) |
|
virtual |
|
protected |
|
inline |
This method returns true if verbose logging has been requested either by setting the BESKeys key/value pair BES.LogVerbose=value or by turning on verbose logging using the method verbose_on.
If BES.LogVerbose is set to Yes, YES, or yes then verbose logging is turned on. If set to anything else then verbose logging is not turned on.
BESLog & BESLog::operator<< | ( | std::string & | s | ) |
s | string to write to the log file |
Definition at line 138 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | const std::string & | s | ) |
s | const string to write to the log file |
Definition at line 151 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | char * | val | ) |
val | char * to write to the log file |
Definition at line 164 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | const char * | val | ) |
val | const char * to write to the log file |
Definition at line 180 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | int | val | ) |
val | int value to write to the log file |
Definition at line 198 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | char | val | ) |
val | char value to write to the log file |
Definition at line 211 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | long | val | ) |
val | long value to write to the log file |
Definition at line 224 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | unsigned long | val | ) |
val | unsigned long value to write to the log file |
Definition at line 237 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | double | val | ) |
val | double value to write to the log file |
Definition at line 250 of file BESLog.cc.
References dump_time().
BESLog & BESLog::operator<< | ( | p_ostream_manipulator | val | ) |
BESLog & BESLog::operator<< | ( | p_ios_manipulator | val | ) |
|
inline |
|
inline |
|
inline |
|
inline |