4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
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
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.
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.
19 // The Original Code is Fraunhofer FOKUS code.
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.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief Definitions public header */
31 #ifndef HH_SENF_Utils_Logger_Definitions_
32 #define HH_SENF_Utils_Logger_Definitions_ 1
36 //#include "Definitions.mpp"
37 #include "Definitions.ih"
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
43 ///\addtogroup logging
45 ///\name Defining logger objects
48 /** \brief Define log stream
50 Defines a new log stream named \a stream. The stream is defined as a symbol in the current
53 \a defaultLevel defines the default log level for messages posted to this stream. \a
54 runtimeLimit defines the default log limit. Messages with a level below this will not be
55 output. \a compileLimit defines the default log level limit at compile time: Messages
56 posted with a level below \a compileLimit will be discarded at compile time.
58 Normally the \a compileLimit will be \c NOTICE. This will enable all messages
59 <em>except</em> \c VERBOSE messages. These must then be enabled explicitly using the compile
60 time \ref config macro.
64 # define SENF_LOG_DEFINE_STREAM(stream, defaultLevel_, runtimeLimit_, compileLimit_) \
66 : public senf::log::detail::StreamBase, public senf::singleton<stream> \
68 typedef defaultLevel_ defaultLevel; \
69 typedef runtimeLimit_ runtimeLimit; \
70 typedef compileLimit_ compileLimit; \
71 static std::string name() { return instance().v_name(); } \
72 unsigned defaultRuntimeLimit() const { return runtimeLimit::value; } \
73 using senf::singleton<stream>::instance; \
75 stream() { init(); } \
76 friend class senf::singleton<stream>; \
79 /** \brief Define log area
81 Defines a new log area named \a area. The area is defined as a symbol in the current scope.
85 # define SENF_LOG_DEFINE_AREA(area) SENF_LOG_DEFINE_AREA_I(area, ; )
87 # define SENF_LOG_DEFINE_NAMED_AREA(area, name) \
88 SENF_LOG_DEFINE_AREA_I(area, \
89 std::string v_name() const { return name; } );
91 /** \brief Define new default log area for the class
93 This command declares the containing class to be it's own default log area. It is such like
94 a combination of \ref SENF_LOG_DEFINE_AREA and \ref SENF_LOG_DEFAULT_AREA with a twist.
98 // See Definitions.ih for implementation details on SENF_LOG_CLASS_AREA
99 # define SENF_LOG_CLASS_AREA() \
100 SENF_LOG_DEFINE_AREA_I( \
102 std::string v_name() const \
103 { std::string s (fullName()); return std::string(s,0,s.size()-13); }); \
104 SENF_LOG_DEFAULT_AREA(SENFLogArea)
107 /** \brief Define log parameter alias
109 Defines a new parameter alias named \a alias as an alias for the parameters in \a args. The
110 alias is defined as a symbol in the current scope.
114 # define SENF_LOG_DEFINE_ALIAS(alias,args) \
115 struct alias : public senf::log::detail::AliasBase \
117 template <class Base> \
120 typedef typename SENF_LOG_MERGE_PARAMETERS_I(Base,args) type; \
124 /** \brief Default global log stream */
125 SENF_LOG_DEFINE_STREAM(Debug, MESSAGE, MESSAGE, NOTICE);
127 /** \brief Default global %log area */
128 SENF_LOG_DEFINE_AREA(DefaultArea);
135 //-/////////////////////////////////////////////////////////////////////////////////////////////////
136 //#include "Definitions.cci"
137 //#include "Definitions.ct"
138 //#include "Definitions.cti"
145 // comment-column: 40
146 // c-file-style: "senf"
147 // indent-tabs-mode: nil
148 // ispell-local-dictionary: "american"
149 // compile-command: "scons -u test"