Lunchbox  1.11.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lunchbox::Log Class Reference

The logging class. More...

#include <log.h>

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

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static LUNCHBOX_API int level
 The current log level. More...
 
static LUNCHBOX_API 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

LUNCHBOX_API void lunchbox::Log::disableFlush ( )

Disable flushing of the log on endl.

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

Disable prefix printing for subsequent new lines.

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

Re-enable flushing of the log on endl.

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

Re-enable prefix printing for subsequent new lines.

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

Un-indent subsequent log output by one level.

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

Exit the log instance for the current thread.

LUNCHBOX_API void lunchbox::Log::forceFlush ( )

Flush all buffered log data.

Version
1.0
static LUNCHBOX_API 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.

LUNCHBOX_API void lunchbox::Log::indent ( )

Indent subsequent log output by one level.

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

The per-thread logger.

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

+ Here is the caller graph for this function:

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

The per-thread logger.

static LUNCHBOX_API 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 LUNCHBOX_API void lunchbox::Log::setOutput ( std::ostream &  stream)
static

Change the output stream.

Version
1.4
static LUNCHBOX_API 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 29 of file perThread.h.

Member Data Documentation

LUNCHBOX_API int lunchbox::Log::level
static

The current log level.

Definition at line 95 of file log.h.

LUNCHBOX_API 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: