dlvhex
2.5.0
|
Singleton logger class. More...
#include <include/dlvhex2/Logger.h>
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 Logger & | Instance () |
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 |
typedef uint32_t Logger::Levels |
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] |
Logger::Levels Logger::getPrintLevels | ( | ) | const |
Get current print levels.
Definition at line 95 of file Logger.cpp.
References printlevels.
Logger & Logger::Instance | ( | ) | [static] |
Get singleton Logger instance.
Definition at line 52 of file Logger.cpp.
References Logger().
Referenced by DependencyGraph::createAuxiliaryRuleIfRequired(), EvalGraphBuilder::createEvalUnit(), BaseModelGenerator::evaluateExternalAtomQuery(), OnlineModelBuilder< EvalGraphT >::getNextIModel(), OnlineModelBuilder< EvalGraphT >::getNextOModel(), Logger::Init::Init(), main(), Mutex(), ParseState::parse(), processOptionsPrePlugin(), RewriteEDBIDBState::rewriteEDBIDB(), DLVProcess::setupStreams(), testABBAProgram(), testAFinProgram(), testCardinalityProgram(), testComplexProgram(), testCsProgram(), testDisjunctionProgram(), testHanoiProgram(), testInconsistentProgram(), testIndirectionProgram(), testIStratified2Program(), testIStratifiedProgram(), testNegationProgram(), testNoticStratifiedProgram(), testOneMainModules(), testReachabilityNonGroundProgram(), testTwoMainModules(), testTwoModuleCalls1(), and testTwoModuleCalls2().
boost::mutex & Logger::Mutex | ( | ) | [static] |
Return Logger mutex for multithreading access.
Definition at line 60 of file Logger.cpp.
References Instance(), shallPrint(), stream(), and WARNING.
void Logger::setPrintLevels | ( | Levels | levels | ) |
Sets one or more levels to print to.
levels | See Logger::printlevels. |
Definition at line 80 of file Logger.cpp.
References ERROR, out, and printlevels.
Referenced by Logger::Init::Init(), main(), processOptionsPrePlugin(), testABBAProgram(), testAFinProgram(), testCardinalityProgram(), testComplexProgram(), testCsProgram(), testDisjunctionProgram(), testHanoiProgram(), testInconsistentProgram(), testIndirectionProgram(), testIStratified2Program(), testIStratifiedProgram(), testNegationProgram(), testNoticStratifiedProgram(), testOneMainModules(), testReachabilityNonGroundProgram(), testTwoMainModules(), testTwoModuleCalls1(), and testTwoModuleCalls2().
void Logger::setPrintLevelWidth | ( | int | width | ) |
Sets width of field for level printing.
width | See 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.
forlevel | Level to check. |
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] |
std::ostream& Logger::stream | ( | ) | [inline] |
Return stream the Logger prints to.
Definition at line 124 of file Logger.h.
Referenced by Mutex(), ParseState::parse(), and RewriteEDBIDBState::rewriteEDBIDB().
const Levels Logger::ANALYZE = 0x20 [static] |
const Levels Logger::DBG = 0x01 [static] |
Debug message.
Definition at line 68 of file Logger.h.
Referenced by DependencyGraph::createAuxiliaryRuleIfRequired(), EvalGraphBuilder::createEvalUnit(), OnlineModelBuilder< EvalGraphT >::getNextIModel(), OnlineModelBuilder< EvalGraphT >::getNextOModel(), and DLVProcess::setupStreams().
const Levels Logger::ERROR = 0x08 [static] |
Error message printed to the user.
Definition at line 74 of file Logger.h.
Referenced by main(), processOptionsPrePlugin(), setPrintLevels(), testABBAProgram(), testAFinProgram(), testCardinalityProgram(), testComplexProgram(), testCsProgram(), testDisjunctionProgram(), testHanoiProgram(), testInconsistentProgram(), testIndirectionProgram(), testIStratified2Program(), testIStratifiedProgram(), testNegationProgram(), testNoticStratifiedProgram(), testOneMainModules(), testReachabilityNonGroundProgram(), testTwoMainModules(), testTwoModuleCalls1(), and testTwoModuleCalls2().
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] |
Model building.
Definition at line 82 of file Logger.h.
Referenced by OnlineModelBuilder< EvalGraphT >::getNextIModel(), and OnlineModelBuilder< EvalGraphT >::getNextOModel().
std::ostream& Logger::out [private] |
const Levels Logger::PLUGIN = 0x10 [static] |
Plugin related things.
Definition at line 78 of file Logger.h.
Referenced by BaseModelGenerator::evaluateExternalAtomQuery().
Levels Logger::printlevels [private] |
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] |
const Levels Logger::WARNING = 0x04 [static] |
Warning message printed to the user.
Definition at line 72 of file Logger.h.
Referenced by main(), Mutex(), processOptionsPrePlugin(), testABBAProgram(), testAFinProgram(), testCardinalityProgram(), testComplexProgram(), testCsProgram(), testDisjunctionProgram(), testHanoiProgram(), testInconsistentProgram(), testIndirectionProgram(), testIStratified2Program(), testIStratifiedProgram(), testNegationProgram(), testNoticStratifiedProgram(), testOneMainModules(), testReachabilityNonGroundProgram(), testTwoMainModules(), testTwoModuleCalls1(), and testTwoModuleCalls2().