4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
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.
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.
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.
24 \brief Definitions public header */
26 #ifndef HH_Definitions_
27 #define HH_Definitions_ 1
31 //#include "Definitions.mpp"
32 #include "Definitions.ih"
33 ///////////////////////////////hh.p////////////////////////////////////////
38 ///\addtogroup logging
40 ///\name Defining logger objects
43 /** \brief Define log stream
45 Defines a new log stream named \a stream. The stream is defined as a symbol in the current
48 \a defaultLevel defines the default log level for messages posted to this stream. \a
49 runtimeLimit defines the default log limit. Messages with a level below this will not be
50 output. \a compileLimit defines the default log level limit at compile time: Messages
51 posted with a level below \a compileLimit will be discarded at compile time.
53 Normally the \a compileLimit will be \c NOTICE. This will enable all messages
54 <em>except</em> \c VERBOSE messages. These must then be enabled explicitly using the compile
55 time \ref config macro.
59 # define SENF_LOG_DEFINE_STREAM(stream, defaultLevel_, runtimeLimit_, compileLimit_) \
61 : public senf::log::detail::StreamBase, public senf::singleton<stream> \
63 typedef defaultLevel_ defaultLevel; \
64 typedef runtimeLimit_ runtimeLimit; \
65 typedef compileLimit_ compileLimit; \
66 static std::string name() { return instance().v_name(); } \
67 unsigned defaultRuntimeLimit() const { return runtimeLimit::value; } \
68 using senf::singleton<stream>::instance; \
70 stream() { init(); } \
71 friend class senf::singleton<stream>; \
74 /** \brief Define log area
76 Defines a new log area named \a area. The area is defined as a symbol in the current scope.
80 # define SENF_LOG_DEFINE_AREA(area) SENF_LOG_DEFINE_AREA_I(area, ; )
82 /** \brief Define new default log area for the class
84 This command declares the containing class to be it's own default log area. It is such like
85 a combination of \ref SENF_LOG_DEFINE_AREA and \ref SENF_LOG_DEFAULT_AREA with a twist.
89 // See Definitions.ih for implementation details on SENF_LOG_CLASS_AREA
90 # define SENF_LOG_CLASS_AREA() \
91 SENF_LOG_DEFINE_AREA_I( \
93 std::string v_name() const \
94 { std::string s (fullName()); return std::string(s,0,s.size()-13); }); \
95 SENF_LOG_DEFAULT_AREA(SENFLogArea)
98 /** \brief Define log parameter alias
100 Defines a new parameter alias named \a alias as an alias for the parameters in \a args. The
101 alias is defined as a symbol in the current scope.
105 # define SENF_LOG_DEFINE_ALIAS(alias,args) \
106 struct alias : public senf::log::detail::AliasBase \
108 template <class Base> \
111 typedef typename SENF_LOG_MERGE_PARAMETERS_I(Base,args) type; \
115 /** \brief Default global log stream */
116 SENF_LOG_DEFINE_STREAM(Debug, MESSAGE, MESSAGE, NOTICE);
118 /** \brief Default global %log area */
119 SENF_LOG_DEFINE_AREA(DefaultArea);
126 ///////////////////////////////hh.e////////////////////////////////////////
127 //#include "Definitions.cci"
128 //#include "Definitions.ct"
129 //#include "Definitions.cti"
136 // comment-column: 40
137 // c-file-style: "senf"
138 // indent-tabs-mode: nil
139 // ispell-local-dictionary: "american"
140 // compile-command: "scons -u test"