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.
55 # define SENF_LOG_DEF_STREAM(stream, defaultLevel_, runtimeLimit_, compileLimit_) \
57 : public senf::log::detail::StreamBase, public senf::singleton<stream> \
59 typedef defaultLevel_ defaultLevel; \
60 typedef runtimeLimit_ runtimeLimit; \
61 typedef compileLimit_ compileLimit; \
62 static std::string name() { return instance().v_name(); } \
63 unsigned defaultRuntimeLimit() const { return runtimeLimit::value; } \
64 using senf::singleton<stream>::instance; \
66 stream() { init(); } \
67 friend class senf::singleton<stream>; \
70 /** \brief Define log area
72 Defines a new log area named \a area. The area is defined as a symbol in the current scope.
76 # define SENF_LOG_DEF_AREA(area) SENF_LOG_DEF_AREA_I(area, ; )
78 /** \brief Define new default log area for the class
80 This command declares the containing class to be it's own default log area. It is such like
81 a combination of \ref SENF_LOG_DEF_AREA and \ref SENF_LOG_DEFAULT_AREA with a twist.
85 # define SENF_LOG_CLASS_AREA() \
86 SENF_LOG_DEF_AREA_I( \
88 std::string v_name() const \
89 { std::string s (fullName()); return std::string(s,0,s.size()-13); }); \
90 SENF_LOG_DEFAULT_AREA(SENFLogArea)
93 /** \brief Define log parameter alias
95 Defines a new parameter alias named \a alias as an alias for the parameters in \a args. The
96 alias is defined as a symbol in the current scope.
100 # define SENF_LOG_DEF_ALIAS(alias,args) \
101 struct alias : public senf::log::detail::AliasBase \
103 template <class Base> \
106 typedef typename SENF_LOG_MERGE_PARAMETERS_I(Base,args) type; \
110 /** \brief Default global log stream */
111 SENF_LOG_DEF_STREAM(Debug, MESSAGE, MESSAGE, MESSAGE);
113 /** \brief Default global %log area */
114 SENF_LOG_DEF_AREA(DefaultArea);
121 ///////////////////////////////hh.e////////////////////////////////////////
122 //#include "Definitions.cci"
123 //#include "Definitions.ct"
124 //#include "Definitions.cti"
131 // comment-column: 40
132 // c-file-style: "senf"
133 // indent-tabs-mode: nil
134 // ispell-local-dictionary: "american"
135 // compile-command: "scons -u test"