Lunchbox  1.15.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox::Log Class Reference

The logging class. More...

#include <log.h>

+ Inheritance diagram for lunchbox::Log:
+ Collaboration diagram for lunchbox::Log:

Public Member Functions

void indent ()
 Indent subsequent log output by one level. More...
 
void exdent ()
 Un-indent subsequent log output by one level. More...
 
void disableFlush ()
 Disable flushing of the log on endl. More...
 
void enableFlush ()
 Re-enable flushing of the log on endl. More...
 
void forceFlush ()
 Flush all buffered log data. More...
 
void disableHeader ()
 Disable prefix printing for subsequent new lines. More...
 
void enableHeader ()
 Re-enable prefix printing for subsequent new lines. More...
 
void setThreadName (const std::string &name)
 
const std::string & getThreadName () const
 

Static Public Member Functions

static Loginstance ()
 The per-thread logger. More...
 
static Loginstance (const char *file, const int line)
 The per-thread logger. More...
 
static void exit ()
 Exit the log instance for the current thread. More...
 
static void reset ()
 
static std::string & getLogLevelString ()
 The string representation of the current log level. More...
 
static int getLogLevel (const char *level)
 
static void setOutput (std::ostream &stream)
 Change the output stream. More...
 
static bool setOutput (const std::string &file)
 Change the output stream to the given file. More...
 
static std::ostream & getOutput ()
 Get the current output stream.
 
static void setClock (Clock *clock)
 Set the reference clock. More...
 
static const ClockgetClock ()
 

Static Public Attributes

static int level
 The current log level. More...
 
static unsigned topics
 The current log topics. More...
 

Friends

template<class T >
void perThreadDelete (T *)
 Default PerThread destructor deleting the object. More...
 

Detailed Description

The logging class.

Should be accessed through the LBVERB, LBDEBUG, LBINFO, LBERROR and LBLOG macros, which manage per-thread instances and their invocation state.

Definition at line 70 of file log.h.

Member Function Documentation

void lunchbox::Log::disableFlush ( )

Disable flushing of the log on endl.

Version
1.0
void lunchbox::Log::disableHeader ( )

Disable prefix printing for subsequent new lines.

Version
1.0
void lunchbox::Log::enableFlush ( )

Re-enable flushing of the log on endl.

Version
1.0
void lunchbox::Log::enableHeader ( )

Re-enable prefix printing for subsequent new lines.

Version
1.0
void lunchbox::Log::exdent ( )

Un-indent subsequent log output by one level.

Version
1.0
static void lunchbox::Log::exit ( )
static

Exit the log instance for the current thread.

void lunchbox::Log::forceFlush ( )

Flush all buffered log data.

Version
1.0
static int lunchbox::Log::getLogLevel ( const char *  level)
static
Returns
the log level of a string representation.
Version
1.3.2
static std::string& lunchbox::Log::getLogLevelString ( )
static

The string representation of the current log level.

void lunchbox::Log::indent ( )

Indent subsequent log output by one level.

Version
1.0
static Log& lunchbox::Log::instance ( )
static

The per-thread logger.

Referenced by lunchbox::Referenced::ref().

+ Here is the caller graph for this function:

static Log& lunchbox::Log::instance ( const char *  file,
const int  line 
)
static

The per-thread logger.

static void lunchbox::Log::setClock ( Clock clock)
static

Set the reference clock.

The clock will be used instantly by all log outputs. Use 0 to reset the clock to the default clock.

Parameters
clockthe reference clock.
static void lunchbox::Log::setOutput ( std::ostream &  stream)
static

Change the output stream.

Version
1.4
static bool lunchbox::Log::setOutput ( const std::string &  file)
static

Change the output stream to the given file.

Version
1.5.1

Friends And Related Function Documentation

template<class T >
void perThreadDelete ( T *  object)
friend

Default PerThread destructor deleting the object.

Version
1.1.2

Definition at line 30 of file perThread.h.

Member Data Documentation

int lunchbox::Log::level
static

The current log level.

Definition at line 95 of file log.h.

unsigned lunchbox::Log::topics
static

The current log topics.

Definition at line 98 of file log.h.


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