#include <Reporter.hpp>
Collaboration diagram for Ionflux::Tools::Reporter:
Public Member Functions | |
Reporter () | |
Constructor. | |
Reporter (int initVerbosityLevel, int initLogLevel, const std::string &initLogPath, const std::string &initLogPrefix, const std::string &initLogSuffix, bool initConsoleTimestamp[], bool initLogTimestamp[]) | |
Constructor. | |
virtual | ~Reporter () |
Destructor. | |
virtual void | setConfig (Node &config) |
Set configuration. | |
virtual void | setVerbosityLevel (int level) |
Set verbosity level. | |
virtual int | getVerbosityLevel () |
Get verbosity level. | |
virtual void | setLogLevel (int level) |
Set log level. | |
virtual int | getLogLevel () |
Get log level. | |
virtual void | setLogFilePath (const std::string &path) |
Set log file path. | |
virtual std::string | getLogFilePath () |
Get log file path. | |
virtual void | setLogFilePrefix (const std::string &prefix) |
Set log file prefix. | |
virtual std::string | getLogFilePrefix () |
Get log file prefix. | |
virtual void | setLogFileSuffix (const std::string &suffix) |
Set log file suffix. | |
virtual std::string | getLogFileSuffix () |
Get log file prefix. | |
virtual void | setTimestamps (bool console[], bool log[]) |
Set timestamp options. | |
virtual void | msg (const std::string &message, int level) |
Submit message for output/logging. | |
virtual void | msg (const std::string &message, int level, bool lineTerm) |
Submit message for output/logging. | |
virtual void | msg (const std::string &message, int level, bool lineTerm, bool timeStamp) |
Submit message for output/logging. | |
virtual bool | assert (bool assertExpr, const std::string &message) |
Assertion. | |
virtual void | writeLogMessage (const std::string &fileName, const std::string &message) |
Write a message to a logfile. | |
virtual int | getLevel (const std::string &level) |
Get numerical verbosity level. | |
virtual void | setAddLineTerm (bool status) |
Set line terminator option. | |
virtual void | redirect (Reporter *newTarget) |
Set redirection target. | |
virtual void | setDump (ByteDump *newDump) |
Set byte dump. | |
virtual void | setCompressLogs (bool newCompressLogs) |
Set logfile compression flag. | |
virtual bool | getCompressLogs () |
Get logfile compression flag. | |
Static Public Member Functions | |
static std::string | createTimestamp (bool useDate, bool useTime, const std::string &dateSep, const std::string &dateTimeSep, const std::string &timeSep, DateTime &dt) |
Create a timestamp. | |
Static Public Attributes | |
static const std::string | DEFAULT_LOGFILE_SUFFIX = ".log" |
Default log file suffix. | |
static const std::string | DEFAULT_LOG_PATH = "logs" |
Default log path. | |
static const int | VL_ASSERT = -20 |
Verbosity/Log level: Assertion. | |
static const int | VL_NONE = 0 |
Verbosity/Log level: Don't output any messages at all. | |
static const int | VL_ERROR_CRIT = 20 |
Verbosity/Log level: Output critical errors only. | |
static const int | VL_ERROR = 40 |
Verbosity/Log level: Include (normal) errors. | |
static const int | VL_WARNING = 60 |
Verbosity/Log level: Include warnings. | |
static const int | VL_WARNING_OPT = 80 |
Verbosity/Log level: Include optional warnings (pedantic mode ;-)). | |
static const int | VL_INFO = 100 |
Verbosity/Log level: Include informational messages. | |
static const int | VL_INFO_OPT = 120 |
Verbosity/Log level: Include optional informational messages. | |
static const int | VL_DEBUG = 140 |
Verbosity/Log level: Include debug messages. | |
static const int | VL_DEBUG_OPT = 160 |
Verbosity/Log level: Include optional debug messages. | |
static const int | VL_DEBUG_INSANE = 180 |
Verbosity/Log level: Include insanely detailed debug messages. | |
static const int | VL_ALL = 500 |
Verbosity/Log level: Output all messages. | |
Protected Attributes | |
int | verbosityLevel |
The current verbosity level. | |
int | logLevel |
The current log level. | |
std::string | logFilePath |
The path where log files should be stored. | |
std::string | logFilePrefix |
The log file prefix. | |
std::string | logFileSuffix |
The log file suffix. | |
bool | consoleTimestamp [2] |
Which timestamps should be used for console output. | |
bool | logTimestamp [2] |
Which timestamps should be used for console output. | |
bool | addLineTerm |
Whether missing line terminators should be added. | |
bool | disableTimestamps |
Whether to disable timestamps completely. | |
ByteDump * | dump |
Optional target to redirect console output to. | |
Reporter * | target |
Optional Reporter to redirect output to. | |
bool | compressLogs |
Compress logfiles flag. | |
DateTime | lastLogTime |
Datetime of last log entry. | |
std::string | lastLogName |
File name of last log entry. |
Allows console output and logging at configurable verbosity and log levels.
The Reporter::VL_INFO and Reporter::VL_INFO_OPT verbosity levels are special in that messages on these levels will be written to standard output (cout). Messages on all other levels will be written to standard error output (cerr).
|
Constructor. Construct new Reporter object. |
|
Constructor. Construct new Reporter object.
|
|
Destructor. Destruct Reporter object. |
|
Assertion.
Perform an assertion check. If the check fails (i.e.,
|
|
Create a timestamp. Creates a timestamp using the specified options.
|
|
Get logfile compression flag.
|
|
Get numerical verbosity level. Translates a verbosity or log level identified by a string to its numerical counterpart which is used by Reporter functions.
|
|
Get log file path. Get the current log file path.
|
|
Get log file prefix. Get the current log file prefix.
|
|
Get log file prefix. Get the current log file suffix.
|
|
Get log level. Get the current log level.
|
|
Get verbosity level. Get the current verbosity level.
|
|
Submit message for output/logging.
Use this function to submit a message for console output or logging. The Reporter class will then do all the rest. :-)
|
|
Submit message for output/logging.
Use this function to submit a message for console output or logging. The Reporter class will then do all the rest. :-)
|
|
Submit message for output/logging. Use this function to submit a message for console output or logging. The Reporter class will then do all the rest. :-)
|
|
Set redirection target. Set a target Reporter object for output redirection. This effectively bypasses all log level settings of the redirecting object.
|
|
Set line terminator option.
Use this function to set whether line terminators should be appended to messages lacking them.
|
|
Set logfile compression flag.
Sets the logfile compression flag. If set to
|
|
Set configuration. Sets the output/logging configuration from a configuration node.
|
|
Set byte dump. Use this function to specify a byte dump. All console output will be redirected to the byte dump instead of being output to the console. You can pass null to this function disable the redirection.
|
|
Set log file path. Sets the path where log files should be stored.
|
|
Set log file prefix. Sets the prefix to be prepended to log file names. This should be something unique to the application or module you wish to create logs for. Otherwise log data for different applications might get written to the same file.
|
|
Set log file suffix. Sets the suffix to be appended to log file names.
|
|
Set log level. Sets the log level for messages written to the logfile.
|
|
Set timestamp options.
Use this function to specify which timestamps you want to have in your console output or logs. Each parameter is an array of two booleans. Set the first value to 'true' to enable date timestamps, use the second value for time timestamps. Any combination is possible, while it doesn't necessarily have to make sense. ;-)
|
|
Set verbosity level. Sets the verbosity level for console messages.
|
|
Write a message to a logfile. Writes the message to specified logfile.
|
|
Whether missing line terminators should be added.
|
|
Compress logfiles flag.
|
|
Which timestamps should be used for console output.
|
|
Default log path.
|
|
Default log file suffix.
|
|
Whether to disable timestamps completely.
|
|
Optional target to redirect console output to.
|
|
File name of last log entry.
|
|
Datetime of last log entry.
|
|
The path where log files should be stored.
|
|
The log file prefix.
|
|
The log file suffix.
|
|
The current log level.
|
|
Which timestamps should be used for console output.
|
|
Optional Reporter to redirect output to.
|
|
The current verbosity level.
|
|
Verbosity/Log level: Output all messages.
|
|
Verbosity/Log level: Assertion. Assertions are output regardless of the log level settings, because they usually indicate that something is seriously wrong with the program. |
|
Verbosity/Log level: Include debug messages.
|
|
Verbosity/Log level: Include insanely detailed debug messages.
|
|
Verbosity/Log level: Include optional debug messages.
|
|
Verbosity/Log level: Include (normal) errors.
|
|
Verbosity/Log level: Output critical errors only.
|
|
Verbosity/Log level: Include informational messages.
|
|
Verbosity/Log level: Include optional informational messages.
|
|
Verbosity/Log level: Don't output any messages at all.
|
|
Verbosity/Log level: Include warnings.
|
|
Verbosity/Log level: Include optional warnings (pedantic mode ;-)).
|