35b58bd879fd9f710bad011665f03cf2a233f5d7
[senf.git] / senf / Utils / Logger / Levels.hh
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief Levels public header */
25
26 #ifndef HH_SENF_Utils_Logger_Levels_
27 #define HH_SENF_Utils_Logger_Levels_ 1
28
29 // Custom includes
30
31 //#include "Levels.mpp"
32 #include "Levels.ih"
33 ///////////////////////////////hh.p////////////////////////////////////////
34
35 namespace senf {
36 namespace log {
37
38     /** \defgroup loglevels Log levels
39
40         These are the valid %log levels with some additional special values:
41
42         <dl><dt>VERBOSE</dt><dd>Really verbose %log messages. Messages at this level are used for
43         internal debugging. They should be enabled only selectively within the areas currently under
44         inspection. The default %log stream senf::log::Debug has these messages <em>disabled</em> at
45         compile time by default. To enable them, see \ref config.</dd>
46
47         <dt>NOTICE</dt><dd>Arbitrary unimportant notice. Message which normally should be disabled
48         but might be informative to better understand the programs operation.</dd>
49
50         <dt>MESSAGE</dt><dd>Purely informative message which should be displayed if not explicitly
51         disabled.</dd>
52
53         <dt>IMPORTANT</dt><dd>Important information or warning which really should be read.</dd>
54
55         <dt>CRITICAL</dt><dd>Error condition which does not terminate the program completely but has
56         non-reversible adverse effects</dd>
57
58         <dt>FATAL</dt><dd>Error condition which does terminate program execution or enforces a
59         restart or some kind of re-initialization with loss of state and context.</dd></dl>
60
61         There are also some special values which <em>must not be used as a %log level</em>:
62
63         <dl><dt>DISABLED</dt><dd>Disable all %log messages.</dd>
64
65         <dt>NONE</dt><dd>Special value which signifies inheritance of the default %log
66         level.</dd></dl>
67
68         Log levels are classes, not numbers. Each %log level class has a \c value member which gives
69         that levels numeric priority. The larger the number, the more important the message is.
70
71         \implementation The %log levels need to be classes since areas and streams are classes: Since
72             %log arguments (stream, area and level) may appear in any order and number, it is much
73             simpler to parse them if they are all of the same type.
74      */
75
76     ///\{
77
78     /** \brief Log level %VERBOSE
79         \see loglevels */
80     struct VERBOSE   : public detail::LevelBase { static unsigned const value = 1; };
81
82     /** \brief Log level %NOTICE
83         \see loglevels */
84     struct NOTICE    : public detail::LevelBase { static unsigned const value = 2; };
85
86     /** \brief Log level %MESSAGE
87         \see loglevels */
88     struct MESSAGE   : public detail::LevelBase { static unsigned const value = 3; };
89
90     /** \brief Log level %IMPORTANT
91         \see loglevels */
92     struct IMPORTANT : public detail::LevelBase { static unsigned const value = 4; };
93
94     /** \brief Log level %CRITICAL
95         \see loglevels */
96     struct CRITICAL  : public detail::LevelBase { static unsigned const value = 5; };
97
98     /** \brief Log level %FATAL
99         \see loglevels */
100     struct FATAL     : public detail::LevelBase { static unsigned const value = 6; };
101
102     /** \brief Disable logging
103         \see loglevels */
104     struct DISABLED  : public detail::LevelBase { static unsigned const value = 7; };
105
106     /** \brief Inherit %log level
107         \see loglevels */
108     struct NONE      : public detail::LevelBase { static unsigned const value = 0; };
109
110     ///\}
111
112     static char const * const LEVELNAMES[8] = {
113         "NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" };
114
115 }}
116
117 ///////////////////////////////hh.e////////////////////////////////////////
118 //#include "Levels.cci"
119 //#include "Levels.ct"
120 //#include "Levels.cti"
121 #endif
122
123 \f
124 // Local Variables:
125 // mode: c++
126 // fill-column: 100
127 // comment-column: 40
128 // c-file-style: "senf"
129 // indent-tabs-mode: nil
130 // ispell-local-dictionary: "american"
131 // compile-command: "scons -u test"
132 // End: