13 #include "Exception.hh"
14 #include "ExceptionLevel.hh"
43 enum errorLevel {debug, info, warning, error, fatal, log};
46 static std::ostream &
mout();
67 static void setOutputs(
int verboseLevel,
int logLevel);
82 static void setLog(
int logLevel);
121 static std::ostream&
nullOut();
124 static std::ostream&
coutOut();
127 static std::ostream&
clogOut();
130 static std::ostream&
cerrOut();
146 static void print(
errorLevel level, std::string message, std::string func);
static std::ostream & mout()
Shorthand that returns output to Pitch::mout(Pitch::debug)
Definition: Pitch.cc:21
static void activateCout(bool isActive)
Activate std::cout If isActive is false, redirects std::cout to /dev/null; if isActive is true...
Definition: Pitch.cc:100
static void print(errorLevel level, std::string message)
Prints a message with a certain severity level.
Definition: Pitch.cc:184
static Pitch * getInstance()
Ensures class is always instantiated whenever needed.
Definition: Pitch.cc:45
static const errorLevel default_error_level
The default error level.
Definition: Pitch.hh:171
static std::ostream * stdlog
ostream that points to std::log
Definition: Pitch.hh:168
static void setException()
Set Exception.
static bool coutIsActive()
Return false if std::cout points to voidout; else true.
Definition: Pitch.cc:108
static void activateCerr(bool isActive)
Activate std::cerr If isActive is false, redirects std::cerr to /dev/null; if isActive is true...
Definition: Pitch.cc:113
static void initialiseOutputs()
Setup outputs.
Definition: Pitch.cc:139
static std::ostream * voidout
Dummy ostream to send stuff to /dev/null.
Definition: Pitch.hh:166
static void setLog(int logLevel)
Set up the log file stream.
Definition: Pitch.cc:69
static Pitch * instance
Pointer to the singleton instance.
Definition: Pitch.hh:174
Pitch()
Constructor is called by any call to mout. Defines std::map output.
Definition: Pitch.cc:17
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 s...
Definition: Pitch.cc:55
static void setStandardOutputs(int verboseLevel)
Turn on/off std::cout, std::cerr, std::clog Redirect the standard outputs to /dev/null or log file de...
Definition: Pitch.cc:93
static std::ostream * stderr
ostream that points to std::err
Definition: Pitch.hh:169
static std::string levelStr(errorLevel level)
Return the level of the error in plain english.
Definition: Pitch.cc:170
static std::ostream & clogOut()
Return ostream pointing to standard log (irrespective of verbose level)
Definition: Pitch.cc:160
static std::ostream & nullOut()
Return ostream pointing to /dev/null (irrespective of verbose level)
Definition: Pitch.cc:150
static std::map< errorLevel, std::ostream * > output
Links an ostream with each error level.
Definition: Pitch.hh:165
static std::ostream & cerrOut()
Return ostream pointing to standard error (irrespective of verb level)
Definition: Pitch.cc:165
static std::ofstream * logfile
ostream that points to a log file
Definition: Pitch.hh:170
exceptionLevel
ExceptionLevel enumerates the severity of the exception.
Definition: ExceptionLevel.hh:16
static void closeLog()
Close the log file and free the memory.
Definition: Pitch.cc:84
static bool cerrIsActive()
Return false if std::cerr points to voidout; else true.
Definition: Pitch.cc:121
Redirect output to std::out, std::cerr or file depending on severity.
Definition: Pitch.hh:40
static void setLogName(std::string aLogname)
Set the log file name.
Definition: Pitch.hh:91
static std::string logname
The log file name.
Definition: Pitch.hh:173
static std::string getLogName()
Return the log file name.
Definition: Pitch.hh:88
static bool clogIsActive()
Return false if std::clog points to voidout; else true.
Definition: Pitch.cc:134
static std::ostream * stdout
ostream that points to std::out
Definition: Pitch.hh:167
static std::ostream & coutOut()
Return ostream pointing to standard output (irrespective of verb level)
Definition: Pitch.cc:155
static void setAnOutput(errorLevel level, std::ostream &out)
Set the ostream for a given error level (Exceptions::Exception)
Definition: Pitch.cc:40
static const int default_log_level
The default log level.
Definition: Pitch.hh:172
static void activateClog(bool isActive)
Activate std::clog If isActive is false, redirects std::clog to /dev/null; if isActive is true...
Definition: Pitch.cc:126
errorLevel
Error level that determines where the output goes.
Definition: Pitch.hh:43