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
18// Redefine TRACE's TLOG to only take 2 optional args: name and format control
19#undef TLOG
20#if TRACE_REVNUM <= 1443
21#define TLOG(...) \
22 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, \
26 1)
27#else
28#define TLOG(...) TRACE_STREAMER(TLVL_LOG, TLOG2(__VA_ARGS__), 1)
29#endif
30
31// TRACE's TLOG_DEBUG maybe OK, depending on the version of TRACE - check at the end of this file
32// TLOG_DBG ???
33
34#undef TLOG_ERROR
35#undef TLOG_WARNING
36#undef TLOG_INFO
37#undef TLOG_TRACE
38#undef TLOG_ARB
39
40#undef ERS_DEBUG
41#undef ERS_INFO
42#undef ERS_LOG
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__( \
48 inline, namespace_name, class_name, base_class_name, message_, base_attributes, attributes) \
49 namespace namespace_name { \
50 static inline TraceStreamer& operator<<(TraceStreamer& x, const class_name& r) \
51 { \
52 if (x.do_m) { \
53 x.line_ = r.context().line_number(); \
54 x.msg_append(r.message().c_str()); \
55 /* MAY NEED TO APPEND CHAINED ISSUE??? */ \
56 } \
57 if (x.do_s) { \
58 if (x.lvl_ == TLVL_INFO) \
59 ers::info(r); \
60 else if (x.lvl_ == TLVL_LOG) \
61 ers::log(r); \
62 else \
63 ers::debug(r, x.lvl_ - TLVL_DEBUG); \
64 x.do_s = 0; \
65 } \
66 return x; \
67 } \
68 }
69
70#undef ERS_DECLARE_ISSUE
71#define ERS_DECLARE_ISSUE(namespace_name, class_name, message_, attributes) \
72 __ERS_DECLARE_ISSUE_BASE__(namespace_name, class_name, ers::Issue, ERS_EMPTY message_, ERS_EMPTY, attributes) \
73 __ERS_DEFINE_ISSUE_BASE__(inline, namespace_name, class_name, ers::Issue, ERS_EMPTY message_, ERS_EMPTY, attributes) \
74 namespace namespace_name { \
75 static inline TraceStreamer& operator<<(TraceStreamer& x, const class_name& r) \
76 { \
77 if (x.do_m) { \
78 x.line_ = r.context().line_number(); \
79 x.msg_append(r.message().c_str()); \
80 /* MAY NEED TO APPEND CHAINED ISSUE??? */ \
81 } \
82 if (x.do_s) { \
83 if (x.lvl_ == TLVL_INFO) \
84 ers::info(r); \
85 else if (x.lvl_ == TLVL_LOG) \
86 ers::log(r); \
87 else \
88 ers::debug(r, x.lvl_ - TLVL_DEBUG); \
89 x.do_s = 0; \
90 } \
91 return x; \
92 } \
93 }
94
95#endif // LOGGING_INCLUDE_LOGGING_INTERNAL_MACRO_HPP_