Although Pantheios can be used with any range severity levels that fits into the int type - which usually means 32- or 64-bits, depending on platform - as it ships Pantheios defines eight stock severity levels, corresponding to the eight levels defined by SysLog, as follows:
Syslog level | Pantheios level (C) | Pantheios level (C++) | Integer value |
---|---|---|---|
Emergency | PANTHEIOS_SEV_EMERGENCY | pantheios::emergency | 0 |
Alert | PANTHEIOS_SEV_ALERT | pantheios::ealert | 1 |
Critical | PANTHEIOS_SEV_CRITICAL | pantheios::critical | 2 |
Error | PANTHEIOS_SEV_ERROR | pantheios::error | 3 |
Warning | PANTHEIOS_SEV_WARNING | pantheios::warning | 4 |
Notice | PANTHEIOS_SEV_NOTICE | pantheios::notice | 5 |
Info | PANTHEIOS_SEV_INFO | pantheios::info | 6 |
Debug | PANTHEIOS_SEV_DEBUG | pantheios::debug | 7 |
Briefly, we treat these levels as follows. (Note, the terminology introduced in the first and second parts of my Quality Matters column for ACCU's Overload will be helpful in several instances.)
- Emergency is used for (attempting to) record contract violations, i.e. the firing of an active runtime contract, indicating that the program is now behaving in contradiction to its design. According to the principle of irrecoverability, a program in this state must immediately terminate, and thus it is possible to see an emergency level message being the last, or one of the last, messages in the diagnostic logging sequence of a program that has faulted.
- Alert is used for (attempting to) record practically-unrecoverable conditions, e.g. out of memory. It is customary to see an alert level message being the last, or one of the last, messages in the diagnostic logging sequence of a program that has ended processing in a non-normative manner.
- Critical and error are used for conditions that usually indicate that the normative behaviour of the program cannot be achieved. There is some ambiguity as to the exact distinction to draw between them, and I'm still in two minds about it. Obviously, critical is more severe, and may be associated with conditions more likely to result in program failure than does those designated as error.
- Warning is used for recording warning conditions.
- Notice is used for logging information that is to be displayed in "normal" operation, e.g. "database connection achieved"
- Informational is used for logging information that is useful when actively monitoring the health of a system, but that is not necessarily displayed as part of "normal" operation. Ideally it should be possible to turn on all logging of this level without exceeding the program's performance criteria.
- Debug is used for debugging statements. Note that one of the important advanges of using Pantheios is that its high efficiency means that you don't have to make decisions about eliding certain statements at compile-time; they can instead be made at runtime, which is appropriate. Using Pantheios means eliminating #ifdef DEBUG from application code, forever!
I hope that's been helpful.
No comments:
Post a Comment