Provides a mechanism for applications to log information to an external file.
More...
|
void | dump (std::ostream &strm) const override |
| dumps information about this object
|
|
void | error (const std::string &msg) const |
| Writes error msg to the log stream.
|
|
std::ostream * | get_log_ostream () const |
|
std::string | get_request_id () const |
|
void | info (const std::string &msg) const |
| Writes info msg to the log stream.
|
|
bool | is_verbose () const |
| Returns true if verbose logging is requested.
|
|
void | request (const std::string &msg) const |
| Writes request msg to the log stream.
|
|
void | set_request_id (const std::string &id) |
| Sets the current request id (cached in BESLog) to id.
|
|
void | timing (const std::string &msg) const |
| Writes timing msg to the log stream.
|
|
void | trace_error (const std::string &msg, const std::string &file, int line) const |
| Writes error msg to the log stream with FILE and LINE.
|
|
void | trace_info (const std::string &msg, const std::string &file, int line) const |
| Writes info msg to the log stream with FILE and LINE.
|
|
void | trace_request (const std::string &msg, const std::string &file, int line) const |
| Writes request msg to the log stream with FILE and LINE.
|
|
void | trace_timing (const std::string &msg, const std::string &file, int line) const |
| Writes timing msg to the log stream with FILE and LINE.
|
|
void | trace_verbose (const std::string &msg, const std::string &file, int line) const |
| Writes verbose msg to the log stream with FILE and LINE, if verbose logging is enabled.
|
|
pid_t | update_pid () |
| Update the d_pid and the d_log_record_prolog_base values.
|
|
void | verbose (const std::string &msg) const |
| Writes verbose msg to the log stream, if verbose logging is enabled.
|
|
void | verbose_off () |
| turns off verbose logging
|
|
void | verbose_on () |
| turn on verbose logging
|
|
| ~BESLog () override |
| Cleans up the logging mechanism.
|
|
Provides a mechanism for applications to log information to an external 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.
A log record is synonymous with a log line. Log fields are seperated by BESLog::mark (currently "|&|")
All log records have a "prolog" which consists of:
current_time + BESLog::mark + to_string(getpid()) + BESLog::mark + "record_type" + BESLog::mark
The BESLog API implements methods to write log records of type request, info, error, verbose, and timing. All of these logs take a single message string as their input. The users of the request logger (BESXMLInterface) and the timing logger (BESStopWatch) are responsible for injecting additional log fields for their respective use cases into the message and ultimately the log record.
It is preferred to use the logging macros REQUEST_LOG(x), INFO_LOG(x), ERROR_LOG(x), VERBOSE_LOG(x), and TIMING_LOG(x) where x is the message string.
INFO_LOG("This is some information to be logged...");
ERROR_LOG("OUCH! The bad things happened!");
VERBOSE_LOG("I'm feeling chatty.");
Note:
BESLog provides a static method for access to a single BESLog object, TheLog.
- See also
- TheBESKeys
Definition at line 114 of file BESLog.h.