Review of Jose Armando Garcia Sancio's std.log
kennytm
kennytm at gmail.com
Wed Mar 7 12:45:43 PST 2012
"Richard van Scheijen" <dlang at mesadu.net> wrote:
> When logging the severity level should convey a certain insight that the
> developer has about the code. This can be done with a 3 bit field. These
> are: known-cause, known-effect and breaks-flow.
>
> This creates the following matrix:
>
> KC KE BF Severity
> =================
> 1 1 0 Trace
> 0 1 0 Info
> 1 0 0 Notice
> 0 0 0 Warning
> 1 1 1 Error
> 0 1 1 Critical
> 1 0 1 Severe
> 0 0 1 Fatal
>
Minor nit: if you rearrange it as
AllowFlow / KnownEffect / KnownCause
Then the description will correspond exactly to their integer values.
111 (7) = Trace
110 (6) = Info
101 (5) = Notice
100 (4) = Warning
011 (3) = Error
010 (2) = Critical
001 (1) = Severe
000 (0) = Fatal
> A known cause is when the developer knows why a log event is made. e.g.:
> if you cannot open a file, you do not know why.
> A known effect is when he/she knows what happens after. Basically, you
> can tell if it is a catch-all by this flag.
>
> When a severity should only be handled by a debugger, the normal debug
> statement should be used. This is in essence a 4th bit.
>
> I hope this helpful in the search for a good level system.
More information about the Digitalmars-d
mailing list