![]() |
SynAPSE
0.6.0
Synergistic Analysis of Phase Space Evolution
|
Redirect output to std::out, std::cerr or file depending on severity. More...
#include <Pitch.hh>
Public Types | |
| enum | errorLevel { debug, info, warning, error, fatal, log } |
| Error level that determines where the output goes. More... | |
Static Public Member Functions | |
| static std::ostream & | mout () |
| Shorthand that returns output to Pitch::mout(Pitch::debug) More... | |
| static std::ostream & | mout (errorLevel level) |
| Returns a reference to the ostream corresponding to the errorLevel. More... | |
| static std::ostream & | mout (Exceptions::exceptionLevel level) |
| Returns a reference to the ostream corresponding to the exceptionLevel. More... | |
| static void | setAnOutput (errorLevel level, std::ostream &out) |
| Set the ostream for a given error level (Exceptions::Exception) More... | |
| static void | setOutputs (int verboseLevel, int logLevel) |
| Set the ostream for all items below "verboseLevel" to /dev/null or the log file (if the logLevel is set to 2) If verboseLevel is less than or equal to: More... | |
| static void | setStandardOutputs (int verboseLevel) |
| Turn on/off std::cout, std::cerr, std::clog Redirect the standard outputs to /dev/null or log file depending on verboseLevel and logLevel: More... | |
| static void | setLog (int logLevel) |
| Set up the log file stream. More... | |
| static void | closeLog () |
| Close the log file and free the memory. More... | |
| static std::string | getLogName () |
| Return the log file name. More... | |
| static void | setLogName (std::string aLogname) |
| Set the log file name. More... | |
| static void | activateCout (bool isActive) |
| Activate std::cout If isActive is false, redirects std::cout to /dev/null; if isActive is true, redirects it to std::cout. More... | |
| static bool | coutIsActive () |
| Return false if std::cout points to voidout; else true. More... | |
| static void | activateCerr (bool isActive) |
| Activate std::cerr If isActive is false, redirects std::cerr to /dev/null; if isActive is true, redirects it to std::cerr. More... | |
| static bool | cerrIsActive () |
| Return false if std::cerr points to voidout; else true. More... | |
| static void | activateClog (bool isActive) |
| Activate std::clog If isActive is false, redirects std::clog to /dev/null; if isActive is true, redirects it to std::clog. More... | |
| static bool | clogIsActive () |
| Return false if std::clog points to voidout; else true. More... | |
| static std::ostream & | nullOut () |
| Return ostream pointing to /dev/null (irrespective of verbose level) More... | |
| static std::ostream & | coutOut () |
| Return ostream pointing to standard output (irrespective of verb level) More... | |
| static std::ostream & | clogOut () |
| Return ostream pointing to standard log (irrespective of verbose level) More... | |
| static std::ostream & | cerrOut () |
| Return ostream pointing to standard error (irrespective of verb level) More... | |
| static std::string | levelStr (errorLevel level) |
| Return the level of the error in plain english. More... | |
| static void | print (errorLevel level, std::string message) |
| Prints a message with a certain severity level. More... | |
| static void | print (errorLevel level, std::string message, std::string func) |
| Prints a message in a given function with a certain severity level. More... | |
Private Member Functions | |
| Pitch () | |
| Constructor is called by any call to mout. Defines std::map output. More... | |
Static Private Member Functions | |
| static Pitch * | getInstance () |
| Ensures class is always instantiated whenever needed. More... | |
| static void | initialiseOutputs () |
| Setup outputs. More... | |
| static void | setException () |
| Set Exception. More... | |
Static Private Attributes | |
| static std::map< errorLevel, std::ostream * > | output |
| Links an ostream with each error level. More... | |
| static std::ostream * | voidout = NULL |
| Dummy ostream to send stuff to /dev/null. More... | |
| static std::ostream * | stdout = NULL |
| ostream that points to std::out More... | |
| static std::ostream * | stdlog = NULL |
| ostream that points to std::log More... | |
| static std::ostream * | stderr = NULL |
| ostream that points to std::err More... | |
| static std::ofstream * | logfile = NULL |
| ostream that points to a log file More... | |
| static const errorLevel | default_error_level = Pitch::warning |
| The default error level. More... | |
| static const int | default_log_level = 0 |
| The default log level. More... | |
| static std::string | logname = "emittance.log" |
| The log file name. More... | |
| static Pitch * | instance = NULL |
| Pointer to the singleton instance. More... | |
Redirect output to std::out, std::cerr or file depending on severity.
Usage: Pitch::mout(Pitch::debug) << "Blah blah" << std::endl;
Pitch is used to redirect output at run time to some output file or standard outputs. Redirection is controlled by errorLevel: debug - debugging information. Deliver information related to debugging errors in the code; verbose developer level output info - run control information. Deliver information related to run information; aimed at users to give summary information about the run (idea is to give a constant, but limited, stream of data to info) warning - information to warn the user of suspected errors in running error - information to warn the user of certain errors in running fatal - final information to tell the user if the code is crashing
We also redirect output according to exceptionLevel recoverable - redirects to error nonRecoverable - redirects to fatal
Pitch is a singleton class - so initialisation is done whenever a function is called and the thing never destructs
| enum Pitch::errorLevel |
Error level that determines where the output goes.
|
private |
Constructor is called by any call to mout. Defines std::map output.
|
static |
Activate std::cerr If isActive is false, redirects std::cerr to /dev/null; if isActive is true, redirects it to std::cerr.
|
static |
Activate std::clog If isActive is false, redirects std::clog to /dev/null; if isActive is true, redirects it to std::clog.
|
static |
Activate std::cout If isActive is false, redirects std::cout to /dev/null; if isActive is true, redirects it to std::cout.
|
static |
Return false if std::cerr points to voidout; else true.
|
static |
Return ostream pointing to standard error (irrespective of verb level)
|
static |
Return false if std::clog points to voidout; else true.
|
static |
Return ostream pointing to standard log (irrespective of verbose level)
|
static |
Close the log file and free the memory.
|
static |
Return false if std::cout points to voidout; else true.
|
static |
Return ostream pointing to standard output (irrespective of verb level)
|
staticprivate |
Ensures class is always instantiated whenever needed.
|
inlinestatic |
Return the log file name.
|
staticprivate |
Setup outputs.
|
static |
Return the level of the error in plain english.
|
static |
Shorthand that returns output to Pitch::mout(Pitch::debug)
|
static |
Returns a reference to the ostream corresponding to the errorLevel.
|
static |
Returns a reference to the ostream corresponding to the exceptionLevel.
|
static |
Return ostream pointing to /dev/null (irrespective of verbose level)
|
static |
Prints a message with a certain severity level.
| level | Level of severity of the message |
| message | Message to print out along with the erreor |
|
static |
Prints a message in a given function with a certain severity level.
| level | Level of severity of the message |
| message | Message to print out along with the erreor |
| func | Function in which the error was encountered |
|
static |
Set the ostream for a given error level (Exceptions::Exception)
|
staticprivate |
Set Exception.
|
static |
Set up the log file stream.
|
inlinestatic |
Set the log file name.
|
static |
Set the ostream for all items below "verboseLevel" to /dev/null or the log file (if the logLevel is set to 2) If verboseLevel is less than or equal to:
|
static |
Turn on/off std::cout, std::cerr, std::clog Redirect the standard outputs to /dev/null or log file depending on verboseLevel and logLevel:
|
staticprivate |
The default error level.
|
staticprivate |
The default log level.
|
staticprivate |
Pointer to the singleton instance.
|
staticprivate |
ostream that points to a log file
|
staticprivate |
The log file name.
|
staticprivate |
Links an ostream with each error level.
|
staticprivate |
ostream that points to std::err
|
staticprivate |
ostream that points to std::log
|
staticprivate |
ostream that points to std::out
|
staticprivate |
Dummy ostream to send stuff to /dev/null.
1.8.6