A class for logging messages. More...
#include <util.h>
Public Member Functions | |
const char * | c_str () const |
Return a nil-terminated version of the string steam content. More... | |
logger (int blanks=0) | |
Constructor. More... | |
std::ostream & | operator() (void) |
Return an output stream for caller to build a message. | |
std::string | str () const |
Return the current content of the string stream in the form of a std::string. More... | |
~logger () | |
Destructor. More... | |
Protected Attributes | |
std::ostringstream | mybuffer |
The message is stored in this buffer. | |
A class for logging messages.
The caller writes message to a std::ostream returned by the function buffer as if to std::cout. Note that messages are stored in this buffer and written out in the destructor of this class. There is a macro LOGGER that can simplify some of the routine stuff. Use function ibis::util::setLogFile to explicit name of the log file or use RC file entry logfile to specify a file name. By default all messages are dump to stdout.
ibis::util::logger::logger | ( | int | lvl = 0 | ) |
Constructor.
The argument to this constructor is taken to be the number of spaces before the message.
When the macro FASTBIT_TIMED_LOG is defined at compile time, a time stamp is printed before the spaces. The number of leading blanks is usually the verboseness level. Typically, a message is formed only if the global verboseness level is higher than the level assigned to the particular message (through the use of LOGGER macro or explicit if statements). In addition, the message is only outputed if the global verboseness level is no less than 0.
References ibis::util::getLocalTime(), and mybuffer.
ibis::util::logger::~logger | ( | ) |
Destructor.
Output the message and timing information from this function.
References ibis::util::getLogFile().
const char * ibis::util::logger::c_str | ( | ) | const |
Return a nil-terminated version of the string steam content.
This function relies on the function std::ostringstream::str, which makes copy of the string stream buffer.
Referenced by ibis::column::logError().
std::string ibis::util::logger::str | ( | ) | const |
Return the current content of the string stream in the form of a std::string.
The content of the string stream is copied into the output string.
Referenced by ibis::part::reorder().