Logging Guidelines » History » Version 1
Vince Lehman, 09/08/2014 12:51 PM
1 | 1 | Vince Lehman | Logging Guidelines |
---|---|---|---|
2 | ================== |
||
3 | |||
4 | ## Log Levels |
||
5 | |||
6 | NONE: no messages |
||
7 | |||
8 | ERROR: used to notify the user of an unexpected or failed event during process execution |
||
9 | |||
10 | WARN: used to notify the user of events that may affect the process or to notify the developer of unusual variable values |
||
11 | |||
12 | INFO: used to notify the user of major process events |
||
13 | |||
14 | DEBUG: used to notify the developer of important variable values and minor process events |
||
15 | |||
16 | TRACE: used to notify the developer of method calls and less important variable values |
||
17 | |||
18 | ALL: all messages |
||
19 | |||
20 | ## Example |
||
21 | ````cpp |
||
22 | bool isFoo(int arg) |
||
23 | { |
||
24 | _LOG_TRACE("isFoo(" << arg << ")"); |
||
25 | |||
26 | if (arg < 0) { |
||
27 | _LOG_ERROR("arg is less than 0! arg must be greater than 0!"); |
||
28 | return false; |
||
29 | } |
||
30 | else if (arg < 10) { |
||
31 | _LOG_WARN("It is unusual for arg to be less than 10"); |
||
32 | } |
||
33 | |||
34 | g_value += arg; |
||
35 | _LOG_DEBUG("g_value == " << g_value); |
||
36 | |||
37 | _LOG_INFO("The return of this method is true and is important."); |
||
38 | return true; |
||
39 | } |
||
40 | ```` |