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 /** \brief Define new default log area for the class
89 This command declares the containing class to be it's own default log area. It is such like
90 a combination of \ref SENF_LOG_DEFINE_AREA and \ref SENF_LOG_DEFAULT_AREA with a twist.
94 // See Definitions.ih for implementation details on SENF_LOG_CLASS_AREA
95 # define SENF_LOG_CLASS_AREA() \
96 SENF_LOG_DEFINE_AREA_I( \
98 std::string v_name() const \
99 { std::string s (fullName()); return std::string(s,0,s.size()-13); }); \
100 SENF_LOG_DEFAULT_AREA(SENFLogArea)
103 /** \brief Define log parameter alias
105 Defines a new parameter alias named \a alias as an alias for the parameters in \a args. The
106 alias is defined as a symbol in the current scope.
110 # define SENF_LOG_DEFINE_ALIAS(alias,args) \
111 struct alias : public senf::log::detail::AliasBase \
113 template <class Base> \
116 typedef typename SENF_LOG_MERGE_PARAMETERS_I(Base,args) type; \
120 /** \brief Default global log stream */
121 SENF_LOG_DEFINE_STREAM(Debug, MESSAGE, MESSAGE, NOTICE);
123 /** \brief Default global %log area */
124 SENF_LOG_DEFINE_AREA(DefaultArea);
131 //-/////////////////////////////////////////////////////////////////////////////////////////////////
132 //#include "Definitions.cci"
133 //#include "Definitions.ct"
134 //#include "Definitions.cti"
141 // comment-column: 40
142 // c-file-style: "senf"
143 // indent-tabs-mode: nil
144 // ispell-local-dictionary: "american"
145 // compile-command: "scons -u test"