Definitions.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Logger_Definitions_
18 #define HH_SENF_Utils_Logger_Definitions_ 1
19 
20 // Custom includes
21 
22 //#include "Definitions.mpp"
23 #include "Definitions.ih"
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 namespace senf {
27 namespace log {
28 
30  //\{
32  //\{
33 
50 # define SENF_LOG_DEFINE_STREAM(stream, defaultLevel_, runtimeLimit_, compileLimit_) \
51  struct stream \
52  : public senf::log::detail::StreamBase, public senf::singleton<stream> \
53  { \
54  typedef defaultLevel_ defaultLevel; \
55  typedef runtimeLimit_ runtimeLimit; \
56  typedef compileLimit_ compileLimit; \
57  static std::string name() { return instance().v_name(); } \
58  unsigned defaultRuntimeLimit() const { return runtimeLimit::value; } \
59  using senf::singleton<stream>::instance; \
60  private: \
61  stream() { init(); } \
62  friend class senf::singleton<stream>; \
63  }
64 
71 # define SENF_LOG_DEFINE_AREA(area) SENF_LOG_DEFINE_AREA_I(area, ; )
72 
73 # define SENF_LOG_DEFINE_NAMED_AREA(area, name) \
74  SENF_LOG_DEFINE_AREA_I(area, \
75  std::string v_name() const { return name; } );
76 
84  // See Definitions.ih for implementation details on SENF_LOG_CLASS_AREA
85 # define SENF_LOG_CLASS_AREA() \
86  SENF_LOG_DEFINE_AREA_I( \
87  SENFLogArea, \
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)
91 
92 
100 # define SENF_LOG_DEFINE_ALIAS(alias,args) \
101  struct alias : public senf::log::detail::AliasBase \
102  { \
103  template <class Base> \
104  struct apply \
105  { \
106  typedef typename SENF_LOG_MERGE_PARAMETERS_I(Base,args) type; \
107  }; \
108  }
109 
111  SENF_LOG_DEFINE_STREAM(Debug, MESSAGE, MESSAGE, NOTICE);
112 
114  SENF_LOG_DEFINE_AREA(DefaultArea);
115 
116  //\}
117  //\}
118 
119 }}
120 
121 //-/////////////////////////////////////////////////////////////////////////////////////////////////
122 //#include "Definitions.cci"
123 //#include "Definitions.ct"
124 //#include "Definitions.cti"
125 #endif
126 
127 
128 // Local Variables:
129 // mode: c++
130 // fill-column: 100
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"
136 // End:
SENF_LOG_DEFINE_AREA(DefaultArea)
Default global log area.
SENF_LOG_DEFINE_STREAM(Debug, MESSAGE, MESSAGE, NOTICE)
Default global log stream.