switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Utils / Logger / Levels.hh
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
24 //
25 // Contributor(s):
26 //   Stefan Bund <g0dil@berlios.de>
27
28 /** \file
29     \brief Levels public header */
30
31 #ifndef HH_SENF_Utils_Logger_Levels_
32 #define HH_SENF_Utils_Logger_Levels_ 1
33
34 // Custom includes
35
36 //#include "Levels.mpp"
37 #include "Levels.ih"
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39
40 namespace senf {
41 namespace log {
42
43     /** \defgroup loglevels Log levels
44
45         These are the valid %log levels with some additional special values:
46
47         <dl><dt>VERBOSE</dt><dd>Really verbose %log messages. Messages at this level are used for
48         internal debugging. They should be enabled only selectively within the areas currently under
49         inspection. The default %log stream senf::log::Debug has these messages <em>disabled</em> at
50         compile time by default. To enable them, see \ref config.</dd>
51
52         <dt>NOTICE</dt><dd>Arbitrary unimportant notice. Message which normally should be disabled
53         but might be informative to better understand the programs operation.</dd>
54
55         <dt>MESSAGE</dt><dd>Purely informative message which should be displayed if not explicitly
56         disabled.</dd>
57
58         <dt>IMPORTANT</dt><dd>Important information or warning which really should be read.</dd>
59
60         <dt>CRITICAL</dt><dd>Error condition which does not terminate the program completely but has
61         non-reversible adverse effects</dd>
62
63         <dt>FATAL</dt><dd>Error condition which does terminate program execution or enforces a
64         restart or some kind of re-initialization with loss of state and context.</dd></dl>
65
66         There are also some special values which <em>must not be used as a %log level</em>:
67
68         <dl><dt>DISABLED</dt><dd>Disable all %log messages.</dd>
69
70         <dt>NONE</dt><dd>Special value which signifies inheritance of the default %log
71         level.</dd></dl>
72
73         Log levels are classes, not numbers. Each %log level class has a \c value member which gives
74         that levels numeric priority. The larger the number, the more important the message is.
75
76         \implementation The %log levels need to be classes since areas and streams are classes: Since
77             %log arguments (stream, area and level) may appear in any order and number, it is much
78             simpler to parse them if they are all of the same type.
79      */
80
81     //\{
82
83     /** \brief Log level %VERBOSE
84         \see loglevels */
85     struct VERBOSE   : public detail::LevelBase { static unsigned const value = 1; };
86
87     /** \brief Log level %NOTICE
88         \see loglevels */
89     struct NOTICE    : public detail::LevelBase { static unsigned const value = 2; };
90
91     /** \brief Log level %MESSAGE
92         \see loglevels */
93     struct MESSAGE   : public detail::LevelBase { static unsigned const value = 3; };
94
95     /** \brief Log level %IMPORTANT
96         \see loglevels */
97     struct IMPORTANT : public detail::LevelBase { static unsigned const value = 4; };
98
99     /** \brief Log level %CRITICAL
100         \see loglevels */
101     struct CRITICAL  : public detail::LevelBase { static unsigned const value = 5; };
102
103     /** \brief Log level %FATAL
104         \see loglevels */
105     struct FATAL     : public detail::LevelBase { static unsigned const value = 6; };
106
107     /** \brief Disable logging
108         \see loglevels */
109     struct DISABLED  : public detail::LevelBase { static unsigned const value = 7; };
110
111     /** \brief Inherit %log level
112         \see loglevels */
113     struct NONE      : public detail::LevelBase { static unsigned const value = 0; };
114
115     //\}
116
117     static char const * const LEVELNAMES[8] = {
118         "NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" };
119
120 }}
121
122 //-/////////////////////////////////////////////////////////////////////////////////////////////////
123 //#include "Levels.cci"
124 //#include "Levels.ct"
125 //#include "Levels.cti"
126 #endif
127
128 \f
129 // Local Variables:
130 // mode: c++
131 // fill-column: 100
132 // comment-column: 40
133 // c-file-style: "senf"
134 // indent-tabs-mode: nil
135 // ispell-local-dictionary: "american"
136 // compile-command: "scons -u test"
137 // End: