ATLAS Offline Software
Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TrigDecisionTool_Logger_h
6 #define TrigDecisionTool_Logger_h
7 
8 #include "AsgTools/AsgTool.h"
10 #include <stdexcept>
11 
12 namespace Trig{
24  class Logger {
25  public:
26  Logger() = default;
27  Logger(asg::AsgTool* logger) { s_logger = logger; }
28 
29  MsgStream& msg() const {
30  if (s_logger) return s_logger->msg();
31  else throw std::runtime_error("TrigDecisionTool Logger not initialized.");
32  }
33  MsgStream& msg(const MSG::Level lvl) const { return msg() << lvl; }
34  bool msgLvl(const MSG::Level lvl) const { return s_logger && s_logger->msgLvl(lvl); }
35 
36  private:
37  // we rely on the AsgTool logging being thread-safe
38  inline static asg::AsgTool* s_logger ATLAS_THREAD_SAFE {nullptr};
39  };
40 }
41 
42 #endif
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
Trig::Logger
Logging adaptor to provide interfaces required for ATH_MSG macros.
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:24
Trig::Logger::msg
MsgStream & msg(const MSG::Level lvl) const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:33
Trig::Logger::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:34
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
Trig::Logger::ATLAS_THREAD_SAFE
static asg::AsgTool *s_logger ATLAS_THREAD_SAFE
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:38
Trig::Logger::msg
MsgStream & msg() const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:29
Trig::Logger::Logger
Logger()=default
Trig::Logger::Logger
Logger(asg::AsgTool *logger)
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:27
AsgTool.h
checker_macros.h
Define macros for attributes used to control the static checker.
python.iconfTool.gui.pad.logger
logger
Definition: pad.py:14