DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
macro.hpp
Go to the documentation of this file.
1#ifndef LOGGING_INCLUDE_LOGGING_INTERNAL_MACRO_HPP_
2#define LOGGING_INCLUDE_LOGGING_INTERNAL_MACRO_HPP_
3
6
7#undef TRACE_LOG_FUNCTION
8#define TRACE_LOG_FUNCTION erstrace_user
9
10// don't worry about ERS_PACKAGE and/or TRACE_NAME -- leave them to the user or build system
11
12//-----------------------------------------------------------------------------
13
14
19// Redefine TRACE's TLOG to only take 2 optional args: name and format control
20#undef TLOG
21#if TRACE_REVNUM <= 1443
22# define TLOG(...) TRACE_STREAMER(TLVL_LOG, \
23 _tlog_ARG2(not_used, CHOOSE_(__VA_ARGS__)(__VA_ARGS__) 0,need_at_least_one), \
24 _tlog_ARG3(not_used, CHOOSE_(__VA_ARGS__)(__VA_ARGS__) 0,"",need_at_least_one), \
25 1, 1)
26#else
27# define TLOG(...) TRACE_STREAMER(TLVL_LOG, TLOG2(__VA_ARGS__), 1)
28#endif
29
30// TRACE's TLOG_DEBUG maybe OK, depending on the version of TRACE - check at the end of this file
31// TLOG_DBG ???
32
33#undef TLOG_ERROR
34#undef TLOG_WARNING
35#undef TLOG_INFO
36#undef TLOG_TRACE
37#undef TLOG_ARB
38
39#undef ERS_DEBUG
40#undef ERS_INFO
41#undef ERS_LOG
42
43
44# undef ERS_DECLARE_ISSUE_BASE
45# define ERS_DECLARE_ISSUE_BASE( namespace_name, class_name, base_class_name, message_, base_attributes, attributes ) \
46 __ERS_DECLARE_ISSUE_BASE__( namespace_name, class_name, base_class_name, message_, base_attributes, attributes ) \
47 __ERS_DEFINE_ISSUE_BASE__( inline, namespace_name, class_name, base_class_name, message_, base_attributes, attributes ) \
48 namespace namespace_name { \
49 static inline TraceStreamer& operator<<(TraceStreamer& x, const class_name &r) \
50 {if (x.do_m) {\
51 x.line_=r.context().line_number(); x.msg_append( r.message().c_str() );\
52 /* MAY NEED TO APPEND CHAINED ISSUE??? */ \
53 } \
54 if (x.do_s) { \
55 if (x.lvl_==TLVL_INFO) ers::info( r ); \
56 else if (x.lvl_==TLVL_LOG) ers::log( r ); \
57 else ers::debug( r, x.lvl_-TLVL_DEBUG ); \
58 x.do_s = 0; \
59 } \
60 return x; \
61 } \
62 }
63
64# undef ERS_DECLARE_ISSUE
65# define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes ) \
66 __ERS_DECLARE_ISSUE_BASE__( namespace_name, class_name, ers::Issue, ERS_EMPTY message_, ERS_EMPTY, attributes ) \
67 __ERS_DEFINE_ISSUE_BASE__( inline, namespace_name, class_name, ers::Issue, ERS_EMPTY message_, ERS_EMPTY, attributes ) \
68 namespace namespace_name { \
69 static inline TraceStreamer& operator<<(TraceStreamer& x, const class_name &r) \
70 {if (x.do_m) {\
71 x.line_=r.context().line_number(); x.msg_append( r.message().c_str() );\
72 /* MAY NEED TO APPEND CHAINED ISSUE??? */ \
73 } \
74 if (x.do_s) { \
75 if (x.lvl_==TLVL_INFO) ers::info( r ); \
76 else if (x.lvl_==TLVL_LOG) ers::log( r ); \
77 else ers::debug( r, x.lvl_-TLVL_DEBUG ); \
78 x.do_s = 0; \
79 } \
80 return x; \
81 } \
82 }
83
84#endif // LOGGING_INCLUDE_LOGGING_INTERNAL_MACRO_HPP_