QualityControl  1.5.1
O2 Data Quality Control Framework
QcInfoLogger.h
Go to the documentation of this file.
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
15 
16 #ifndef QC_CORE_QCINFOLOGGER_H
17 #define QC_CORE_QCINFOLOGGER_H
18 
19 #include <InfoLogger/InfoLogger.hxx>
20 #include <InfoLogger/InfoLoggerMacros.hxx>
21 
22 typedef AliceO2::InfoLogger::InfoLogger infologger; // not to have to type the full stuff each time
23 typedef AliceO2::InfoLogger::InfoLoggerContext infoContext;
24 
26 {
27 
42 {
43 
44  public:
45  static QcInfoLogger& GetInstance()
46  {
47  // Guaranteed to be destroyed. Instantiated on first use
48  static QcInfoLogger foo;
49  return foo;
50  }
51 
52  void setFacility(const std::string& facility);
53 
54  private:
55  QcInfoLogger();
56  ~QcInfoLogger() override = default;
57 
58  // Disallow copying
59  QcInfoLogger& operator=(const QcInfoLogger&) = delete;
60  QcInfoLogger(const QcInfoLogger&) = delete;
61 };
62 
63 } // namespace o2::quality_control::core
64 
65 // Define shortcuts to our instance using macros.
66 #define ILOG_INST o2::quality_control::core::QcInfoLogger::GetInstance()
67 #define ILOGI ILOG_INST << AliceO2::InfoLogger::InfoLogger::Info
68 #define ILOGW ILOG_INST << AliceO2::InfoLogger::InfoLogger::Warning
69 #define ILOGE ILOG_INST << AliceO2::InfoLogger::InfoLogger::Error
70 #define ILOGF ILOG_INST << AliceO2::InfoLogger::InfoLogger::Fatal
71 #define ENDM AliceO2::InfoLogger::InfoLogger::endm;
72 
73 #define NUM_ARGS_(_1, _2, _3, _4, _5, _6, _7, _8, TOTAL, ...) TOTAL
74 #define NUM_ARGS(...) NUM_ARGS_(__VA_ARGS__, 6, 5, 4, 3, 2, 1, 0)
75 #define CONCATENATE(X, Y) X##Y
76 #define CONCATE(MACRO, NUMBER) CONCATENATE(MACRO, NUMBER)
77 #define VA_MACRO(MACRO, ...) \
78  CONCATE(MACRO, NUM_ARGS(__VA_ARGS__)) \
79  (__VA_ARGS__)
80 
81 #define ILOG(...) VA_MACRO(ILOG, void, void, __VA_ARGS__)
82 // TODO understand why the zero argument does not work.
83 // the code is derived from https://stackoverflow.com/questions/16683146/can-macros-be-overloaded-by-number-of-arguments
84 #define ILOG0(s, t) \
85  ILOG_INST << AliceO2::InfoLogger::InfoLogger::InfoLoggerMessageOption { AliceO2::InfoLogger::InfoLogger::Severity::Info, AliceO2::InfoLogger::InfoLogger::Level::Support, AliceO2::InfoLogger::InfoLogger::undefinedMessageOption.errorCode, __FILE__, __LINE__ }
86 #define ILOG1(s, t, severity) \
87  ILOG_INST << AliceO2::InfoLogger::InfoLogger::InfoLoggerMessageOption { AliceO2::InfoLogger::InfoLogger::Severity::severity, AliceO2::InfoLogger::InfoLogger::Level::Support, AliceO2::InfoLogger::InfoLogger::undefinedMessageOption.errorCode, __FILE__, __LINE__ }
88 #define ILOG2(s, t, severity, level) \
89  ILOG_INST << AliceO2::InfoLogger::InfoLogger::InfoLoggerMessageOption { AliceO2::InfoLogger::InfoLogger::Severity::severity, AliceO2::InfoLogger::InfoLogger::Level::level, AliceO2::InfoLogger::InfoLogger::undefinedMessageOption.errorCode, __FILE__, __LINE__ }
90 
91 #endif // QC_CORE_QCINFOLOGGER_H
These methods can be used to build a complex processing topology. It spawns 3 separate dummy processi...
Definition: Activity.h:19
Singleton class that any class in the QC can use to log.
Definition: QcInfoLogger.h:41