ATLAS Offline Software
Tracking/Acts/ActsInterop/ActsInterop/Logger.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #pragma once
6 
7 #include "Acts/Utilities/Logger.hpp"
8 #include "GaudiKernel/MsgStream.h"
9 #include "GaudiKernel/CommonMessaging.h"
10 #include "GaudiKernel/INamedInterface.h"
11 
12 #include <memory>
13 
14 #include <optional>
15 
16 class ActsAthenaPrintPolicy final : public Acts::Logging::OutputPrintPolicy
17 {
18 public:
19 
20  ActsAthenaPrintPolicy(IMessageSvc* svc, std::shared_ptr<MsgStream> msg, const std::string& name)
21  : m_svc{svc}, m_msg(msg), m_name(name) {}
22 
23  void
24  flush(const Acts::Logging::Level& lvl, const std::string& input) override;
25 
26  virtual
27  const std::string&
28  name() const override;
29 
30  virtual
31  std::unique_ptr<Acts::Logging::OutputPrintPolicy>
32  clone(const std::string& name) const override;
33 
34 private:
35  IMessageSvc* m_svc;
36  std::shared_ptr<MsgStream> m_msg;
37  std::string m_name;
38 };
39 
40 class ActsAthenaFilterPolicy final : public Acts::Logging::OutputFilterPolicy {
41 public:
42  ActsAthenaFilterPolicy(std::shared_ptr<MsgStream> msg) : m_msg(msg) {}
43 
44  bool doPrint(const Acts::Logging::Level& lvl) const override;
45 
46  virtual
48  level() const override;
49 
50  virtual
51  std::unique_ptr<Acts::Logging::OutputFilterPolicy>
52  clone(Acts::Logging::Level level) const override;
53 
54 private:
55  std::shared_ptr<MsgStream> m_msg;
56 };
57 
58 
59 std::unique_ptr<const Acts::Logger>
60 makeActsAthenaLogger(IMessageSvc *svc, const std::string& name,
61  int level, std::optional<std::string> parent_name);
62 
63 std::unique_ptr<const Acts::Logger>
64 makeActsAthenaLogger(const CommonMessagingBase* parent, const std::string& name);
65 
66 std::unique_ptr<const Acts::Logger>
67 makeActsAthenaLogger(const CommonMessagingBase* parent, const std::string& name,
68  std::optional<std::string> parent_name);
69 
70 // problem: string literal does not play well with std::optional
71 std::unique_ptr<const Acts::Logger>
72 makeActsAthenaLogger(const CommonMessagingBase* parent, const std::string& name,
73  const std::string& parent_name);
74 
ActsAthenaPrintPolicy::name
virtual const std::string & name() const override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:28
ActsAthenaPrintPolicy::m_msg
std::shared_ptr< MsgStream > m_msg
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:36
ActsAthenaFilterPolicy::ActsAthenaFilterPolicy
ActsAthenaFilterPolicy(std::shared_ptr< MsgStream > msg)
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:42
ActsAthenaFilterPolicy::m_msg
std::shared_ptr< MsgStream > m_msg
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:55
ActsAthenaFilterPolicy::clone
virtual std::unique_ptr< Acts::Logging::OutputFilterPolicy > clone(Acts::Logging::Level level) const override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:56
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
makeActsAthenaLogger
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:64
ActsAthenaPrintPolicy::ActsAthenaPrintPolicy
ActsAthenaPrintPolicy(IMessageSvc *svc, std::shared_ptr< MsgStream > msg, const std::string &name)
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:20
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsAthenaPrintPolicy::clone
virtual std::unique_ptr< Acts::Logging::OutputPrintPolicy > clone(const std::string &name) const override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:34
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
ActsAthenaFilterPolicy
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsAthenaPrintPolicy::flush
void flush(const Acts::Logging::Level &lvl, const std::string &input) override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:21
ActsAthenaPrintPolicy
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:17
ActsAthenaPrintPolicy::m_svc
IMessageSvc * m_svc
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:35
ActsAthenaFilterPolicy::level
virtual Acts::Logging::Level level() const override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:50
ActsAthenaPrintPolicy::m_name
std::string m_name
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:37
ActsAthenaFilterPolicy::doPrint
bool doPrint(const Acts::Logging::Level &lvl) const override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:42
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7