Vault
4.1
|
This class holds the constants defining the log levels. More...
#include <vlogger.h>
Static Public Member Functions | |
static VString | getName (int level) |
Returns the name of the level as a string, used primarily to format the level in log output. | |
static int | fromString (const VString &value) |
Returns the level integer from a string representation of the value. | |
Static Public Attributes | |
static const int | OFF = 0 |
Level of detail to suppress all output. | |
static const int | FATAL = 1 |
Level of detail to only show failures likely to be fatal. | |
static const int | ERROR = 20 |
Level of detail to add error messages. | |
static const int | WARN = 40 |
Level of detail to add basic warning messages. | |
static const int | INFO = 60 |
Level of detail to add coarse-grained status messages. | |
static const int | DEBUG = 80 |
Level of detail to add fine-grained status messages. | |
static const int | TRACE = 100 |
Level of detail to add trace-level messages. | |
static const int | ALL = 100 |
Level of detail to output all messages. |
This class holds the constants defining the log levels.
You can use other level values between these for more granular output filtering, but named macros are provided for logging at each of the key predefined levels from fatal to trace.
VString VLoggerLevel::getName | ( | int | level | ) | [static] |
Returns the name of the level as a string, used primarily to format the level in log output.
Levels that match one of the named constants are returned as the name in all caps, padded with spaces to 5 characters. Levels for in-between values are returned as 5-characters, with the first three being an abbreviation of the next lowest named constant, plus two digits of the actual value. For example: "DBG82" for level 82. Levels above 100 (which are normally invalid) are returned as five padded digits. We pad everything to 5 for well-aligned log output.
level | the level to be converted to a string |
Definition at line 273 of file vlogger.cpp.
int VLoggerLevel::fromString | ( | const VString & | value | ) | [static] |
Returns the level integer from a string representation of the value.
The value can be an integer string, or can be one of the specific named values (case-insensitive). Anything else will throw a VRangeException. Padding named values with spaces will not successfully match. In-between value strings such as those returned by getName() (e.g. "DBG82") will not successfully match.
value | a string such as "82" or "INFO" |
Definition at line 303 of file vlogger.cpp.
References ALL, DEBUG, VString::equalsIgnoreCase(), ERROR, FATAL, INFO, OFF, VString::parseInt(), TRACE, and WARN.