Public Member Functions | Protected Attributes | List of all members
ibis::util::logger Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

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().

Member Function Documentation

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().


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

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive