This class will be used by all libraries.
Typical usage of this class is as follows:
ErrorLogSevere( "Error: " << file_name << " not readable.\n");
Public Types | |
Debug = 1 | |
Debugging Messages, high volume. | |
Info = 10 | |
Just for information. | |
ImpInfo = 11 | |
Information that provides program flow. | |
NotSevere = 20 | |
Environment problem, can slide. | |
NotAnticipated = 21 | |
Software Bug, needs programmer attention. | |
Severe = 22 | |
Environment problem, needs user attention. | |
Logical = 23 | |
Software Bug, needs programmer attention. | |
enum | Severity { Debug = 1, Info = 10, ImpInfo = 11, NotSevere = 20, NotAnticipated = 21, Severe = 22, Logical = 23 } |
Public Member Functions | |
~ErrorLog () | |
Not virtual since you are not meant to derive from ErrorLog. | |
Static Public Member Functions | |
static void | startLogging (std::ostream *s) |
The logger starts logging to the passed in stream. | |
static void | stopLogging (std::ostream *s) |
The logger stops logging to the passed in stream if there are no other references to this stream. | |
static void | pauseLogging () |
Pause logging. | |
static void | restartLogging () |
Pause logging. | |
static Streams & | get (Severity req_level) |
Returns the current stream that the end-user of the library has specified. | |
static void | setSeverityThreshold (Severity new_level) |
Change the severity threshold. | |
static bool | shouldLog (Severity desired_level) |
Is above level? | |
static void | setSeverityThreshold (int &argc, char **&argv) |
Parses an application's command-line to set up the error threshold. | |
static void | setLogSize (int newSize) |
Set a size beyond which the log file should not grow. | |
Classes | |
class | Streams |
Streams to log to. More... |
code::ErrorLog::~ErrorLog | ( | ) |
Not virtual since you are not meant to derive from ErrorLog.
Returns the current stream that the end-user of the library has specified.
req_level | the severity level of the message(s) that you are going to log to this stream. |
static void code::ErrorLog::pauseLogging | ( | ) | [static] |
Pause logging.
This is useful when calling a function that you know could cause an error. Remember to call restartLogging ...
Nested calls to pause and restart are allowed.
static void code::ErrorLog::restartLogging | ( | ) | [static] |
Pause logging.
This is useful when calling a function that you know could cause an error ... You might want to call restartLogging ...
static void code::ErrorLog::setLogSize | ( | int | newSize | ) | [static] |
Set a size beyond which the log file should not grow.
The log file will be cycled through at this point.
static void code::ErrorLog::setSeverityThreshold | ( | int & | argc, | |
char **& | argv | |||
) | [static] |
Parses an application's command-line to set up the error threshold.
Users will invoke applications this way:
myalg --verbose=3 --logSize=10000where the verbosity number can be anywhere from 0 (quiet, the default) to 4 (garrulous).
The special case,
myalg --verbosewill cause logging to be garrulous.
Will remove the verbose argument, so that applications can process the command line without worry about whether there was a verbose flag passed in. The logSize argument is similarly processed.
static void code::ErrorLog::setSeverityThreshold | ( | Severity | new_level | ) | [inline, static] |
Change the severity threshold.
By default, it is at ImpInfo
static bool code::ErrorLog::shouldLog | ( | Severity | desired_level | ) | [inline, static] |
Is above level?
static void code::ErrorLog::startLogging | ( | std::ostream * | s | ) | [static] |
The logger starts logging to the passed in stream.
s | stream to log to. |
static void code::ErrorLog::stopLogging | ( | std::ostream * | s | ) | [static] |
The logger stops logging to the passed in stream if there are no other references to this stream.