dlvhex  2.5.0
Logger Class Reference

Singleton logger class. More...

#include <include/dlvhex2/Logger.h>

Collaboration diagram for Logger:

Data Structures

class  Closure
 Allows for printing within a given scope using some indent. More...
class  Init
 Logger initializer. More...

Public Types

typedef uint32_t Levels
 Levels are specified and can be activated via bitmasks.

Public Member Functions

std::ostream & stream ()
 Return stream the Logger prints to.
void setPrintLevels (Levels levels)
 Sets one or more levels to print to.
void setPrintLevelWidth (int width)
 Sets width of field for level printing.
Levels getPrintLevels () const
 Get current print levels.
void startline (Levels forlevel)
 Starts a new output line-.
bool shallPrint (Levels forlevel)
 Checks for a given level if it shall be printed according to the current settings.

Static Public Member Functions

static LoggerInstance ()
 Get singleton Logger instance.
static boost::mutex & Mutex ()
 Return Logger mutex for multithreading access.

Static Public Attributes

static const Levels DBG = 0x01
 Debug message.
static const Levels INFO = 0x02
 Info message printed to the user.
static const Levels WARNING = 0x04
 Warning message printed to the user.
static const Levels ERROR = 0x08
 Error message printed to the user.
static const Levels PLUGIN = 0x10
 Plugin related things.
static const Levels ANALYZE = 0x20
 Program analysis.
static const Levels MODELB = 0x40
 Model building.
static const Levels STATS = 0x80
 Statistic information.

Private Member Functions

 Logger ()
 Constructor.
 ~Logger ()
 Destructor.

Private Attributes

std::ostream & out
 Stream to print to.
boost::thread_specific_ptr
< std::string > 
indent
 Indent to be printed at the beginning of lines.
Levels printlevels
 One or more levels to print (bitwise or).
int levelwidth
 Width of field for level printing, if 0, level is not printed.

Friends

class Closure

Detailed Description

Singleton logger class.

Definition at line 61 of file Logger.h.


Member Typedef Documentation

typedef uint32_t Logger::Levels

Levels are specified and can be activated via bitmasks.

All 32 bits may be used. Logger itself logs on DBG.

Definition at line 66 of file Logger.h.


Constructor & Destructor Documentation

Logger::Logger ( ) [inline, private]

Constructor.

Default output is std::cerr, change this later with stream() = ... . Default output is all output levels, change this later with printlevels() = ... . Default output is i hex character of level printed, change this later with levelwidth() = ... .

Definition at line 102 of file Logger.h.

Referenced by Instance().

Logger::~Logger ( ) [inline, private]

Destructor.

Definition at line 106 of file Logger.h.


Member Function Documentation

Get current print levels.

Returns:
See Logger::printlevels.

Definition at line 95 of file Logger.cpp.

References printlevels.

boost::mutex & Logger::Mutex ( ) [static]

Return Logger mutex for multithreading access.

Returns:
Logger mutex for multithreading access.

Definition at line 60 of file Logger.cpp.

References Instance(), shallPrint(), stream(), and WARNING.

void Logger::setPrintLevelWidth ( int  width)

Sets width of field for level printing.

Parameters:
widthSee Logger::levelwidth.

Definition at line 88 of file Logger.cpp.

References levelwidth.

Referenced by main().

bool Logger::shallPrint ( Levels  forlevel) [inline]

Checks for a given level if it shall be printed according to the current settings.

Parameters:
forlevelLevel to check.
Returns:
True if forlevel shall be printed.

Definition at line 154 of file Logger.h.

Referenced by Logger::Closure::Closure(), Mutex(), ParseState::parse(), and RewriteEDBIDBState::rewriteEDBIDB().

void Logger::startline ( Levels  forlevel) [inline]

Starts a new output line-.

This method does not ask shallPrint!

Parameters:
forlevelPrint level.

Definition at line 141 of file Logger.h.

std::ostream& Logger::stream ( ) [inline]

Return stream the Logger prints to.

Returns:
Stream.

Definition at line 124 of file Logger.h.

Referenced by Mutex(), ParseState::parse(), and RewriteEDBIDBState::rewriteEDBIDB().


Friends And Related Function Documentation

friend class Closure [friend]

Definition at line 157 of file Logger.h.


Field Documentation

const Levels Logger::ANALYZE = 0x20 [static]

Program analysis.

Definition at line 80 of file Logger.h.

boost::thread_specific_ptr<std::string> Logger::indent [private]

Indent to be printed at the beginning of lines.

Definition at line 90 of file Logger.h.

Referenced by Logger::Closure::Closure().

const Levels Logger::INFO = 0x02 [static]

Info message printed to the user.

Definition at line 70 of file Logger.h.

Referenced by ParseState::parse(), processOptionsPrePlugin(), RewriteEDBIDBState::rewriteEDBIDB(), and testOneMainModules().

int Logger::levelwidth [private]

Width of field for level printing, if 0, level is not printed.

Definition at line 94 of file Logger.h.

Referenced by setPrintLevelWidth().

const Levels Logger::MODELB = 0x40 [static]
std::ostream& Logger::out [private]

Stream to print to.

Definition at line 88 of file Logger.h.

Referenced by setPrintLevels().

const Levels Logger::PLUGIN = 0x10 [static]

Plugin related things.

Definition at line 78 of file Logger.h.

Referenced by BaseModelGenerator::evaluateExternalAtomQuery().

One or more levels to print (bitwise or).

Definition at line 92 of file Logger.h.

Referenced by getPrintLevels(), and setPrintLevels().

const Levels Logger::STATS = 0x80 [static]

Statistic information.

Definition at line 84 of file Logger.h.


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