#include <BESLog.h>
Inheritance diagram for BESLog:
Public Types | |
typedef ios &(*) | p_ios_manipulator (ios &) |
Defines a data type p_ios_manipulator "pointer to function that takes ios& and returns ios&". | |
typedef ostream &(*) | p_ostream_manipulator (ostream &) |
Defines a data type p_ostream_manipulator "pointer to function that takes ostream& and returns ostream&". | |
Public Member Functions | |
~BESLog () | |
Cleans up the logging mechanism. | |
void | suspend () |
Suspend logging of any information until resumed. | |
void | resume () |
Resumes logging after being suspended. | |
void | verbose_on () |
turn on verbose logging | |
void | verbose_off () |
turns off verbose logging | |
bool | is_verbose () |
Returns true if verbose logging is requested. | |
BESLog & | operator<< (string &) |
Overloaded inserter that writes the specified string. | |
BESLog & | operator<< (const string &) |
Overloaded inserter that writes the specified const string. | |
BESLog & | operator<< (char *) |
Overloaded inserter that writes the specified char *. | |
BESLog & | operator<< (const char *) |
Overloaded inserter that writes the specified const char *. | |
BESLog & | operator<< (int) |
Overloaded inserter that writes the specified int value. | |
BESLog & | operator<< (char) |
Overloaded inserter that writes the specified char value. | |
BESLog & | operator<< (long) |
Overloaded inserter that writes the specified long value. | |
BESLog & | operator<< (unsigned long) |
Overloaded inserter that writes the specified unsigned long value. | |
BESLog & | operator<< (double) |
Overloaded inserter that writes the specified double value. | |
BESLog & | operator<< (p_ostream_manipulator) |
Overloaded inserter that takes stream manipulation methods. | |
BESLog & | operator<< (p_ios_manipulator) |
Overloaded inserter that takes ios methods. | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
Static Public Member Functions | |
static BESLog * | TheLog () |
Protected Member Functions | |
BESLog () | |
constructor that sets up logging for the application. | |
void | dump_time () |
Protected method that dumps the date/time to the log file. |
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.
Definition at line 87 of file BESLog.h.
typedef ios&(*) BESLog::p_ios_manipulator(ios &) |
typedef ostream&(*) BESLog::p_ostream_manipulator(ostream &) |
BESLog::BESLog | ( | ) | [protected] |
constructor that sets up logging for the application.
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.
BESLogException | if BESLogName is not set or if there are problems opening or writing to the log file. |
Definition at line 62 of file BESLog.cc.
References BESKeys::get_key(), and TheBESKeys::TheKeys().
Here is the call graph for this function:
BESLog::~BESLog | ( | ) |
void BESLog::dump_time | ( | ) | [protected] |
Protected method that dumps the date/time to the log file.
The time is dumped to the log file in the format:
[MDT Thu Sep 9 11:05:16 2004 id: <pid>]
Definition at line 121 of file BESLog.cc.
Referenced by operator<<().
void BESLog::suspend | ( | ) | [inline] |
Suspend logging of any information until resumed.
This method suspends any logging of information. If already suspended then nothing changes, logging is still suspended.
Definition at line 111 of file BESLog.h.
Referenced by BESMemoryGlobalArea::BESMemoryGlobalArea().
void BESLog::resume | ( | ) | [inline] |
Resumes logging after being suspended.
This method resumes logging after suspended by the user. If logging was not already suspended this method does nothing.
Definition at line 121 of file BESLog.h.
Referenced by BESMemoryGlobalArea::BESMemoryGlobalArea().
void BESLog::verbose_on | ( | ) | [inline] |
void BESLog::verbose_off | ( | ) | [inline] |
bool BESLog::is_verbose | ( | ) | [inline] |
Returns true if verbose logging is requested.
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<< | ( | string & | s | ) |
Overloaded inserter that writes the specified string.
s | string to write to the log file |
Definition at line 140 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | const string & | s | ) |
Overloaded inserter that writes the specified const string.
s | const string to write to the log file |
Definition at line 155 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | char * | val | ) |
Overloaded inserter that writes the specified char *.
val | char * to write to the log file |
Definition at line 170 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | const char * | val | ) |
Overloaded inserter that writes the specified const char *.
val | const char * to write to the log file |
Definition at line 188 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | int | val | ) |
Overloaded inserter that writes the specified int value.
val | int value to write to the log file |
Definition at line 208 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | char | val | ) |
Overloaded inserter that writes the specified char value.
val | char value to write to the log file |
Definition at line 223 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | long | val | ) |
Overloaded inserter that writes the specified long value.
val | long value to write to the log file |
Definition at line 238 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | unsigned long | val | ) |
Overloaded inserter that writes the specified unsigned long value.
val | unsigned long value to write to the log file |
Definition at line 253 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | double | val | ) |
Overloaded inserter that writes the specified double value.
val | double value to write to the log file |
Definition at line 268 of file BESLog.cc.
References dump_time().
Here is the call graph for this function:
BESLog & BESLog::operator<< | ( | p_ostream_manipulator | val | ) |
Overloaded inserter that takes stream manipulation methods.
Overloaded inserter that can take the address of endl, flush and ends functions. This inserter is based on p_ostream_manipulator, therefore the C++ standard functions for I/O endl, flush, and ends can be applied to objects of the class BESLog.
BESLog & BESLog::operator<< | ( | p_ios_manipulator | val | ) |
Overloaded inserter that takes ios methods.
Overloaded inserter that can take the address oct, dec and hex functions. This inserter is based on p_ios_manipulator, therefore the C++ standard functions oct, dec and hex can be applied to objects of the class BESLog.
void BESLog::dump | ( | ostream & | strm | ) | const [virtual] |
dumps information about this object
Displays the pointer value of this instance along with information about the log file
strm | C++ i/o stream to dump the information to |
Implements BESObj.
Definition at line 318 of file BESLog.cc.
References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
Here is the call graph for this function:
BESLog * BESLog::TheLog | ( | ) | [static] |
Definition at line 339 of file BESLog.cc.
Referenced by BESMemoryGlobalArea::BESMemoryGlobalArea(), BESCmdInterface::build_data_request_plan(), BESCmdInterface::clean(), BESDDXResponseHandler::execute(), BESCmdInterface::execute_data_request_plan(), TestModule::initialize(), BESApacheInterface::initialize(), BESCmdInterface::invoke_aggregation(), BESCmdInterface::log_status(), BESContainerStorageList::look_for(), OPENDAP_CLASSCmdInit(), OPENDAP_CLASSInit(), OPENDAP_CLASSTerm(), BESMemoryManager::release_global_pool(), BESMemoryManager::swap_memory(), TestModule::terminate(), and BESCmdInterface::transmit_data().