ATLAS Offline Software
Tracking/Acts/ActsInterop/ActsInterop/Logger.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 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"
13 #include <memory>
14 
15 #include <optional>
16 
17 class ActsAthenaPrintPolicy final : public Acts::Logging::OutputPrintPolicy
18 {
19 public:
20 
21  ActsAthenaPrintPolicy(std::shared_ptr<MsgStream> msg, const std::string& 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 AthMessaging* parent, const std::string& name);
68 
69 std::unique_ptr<const Acts::Logger>
70 makeActsAthenaLogger(const CommonMessagingBase* parent, const std::string& name,
71  std::optional<std::string> parent_name);
72 
73 // problem: string literal does not play well with std::optional
74 std::unique_ptr<const Acts::Logger>
75 makeActsAthenaLogger(const CommonMessagingBase* parent, const std::string& name,
76  const std::string& parent_name);
77 
78 
79 
ActsAthenaPrintPolicy::name
virtual const std::string & name() const override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:33
ActsAthenaPrintPolicy::m_msg
std::shared_ptr< MsgStream > m_msg
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:36
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
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
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:39
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
columnar::final
CM final
Definition: ColumnAccessor.h:106
ActsAthenaFilterPolicy
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActsAthenaPrintPolicy::flush
void flush(const Acts::Logging::Level &lvl, const std::string &input) override
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:26
ActsAthenaPrintPolicy::ActsAthenaPrintPolicy
ActsAthenaPrintPolicy(std::shared_ptr< MsgStream > msg, const std::string &name)
Definition: Tracking/Acts/ActsInterop/src/Logger.cxx:21
AthMessaging.h
ActsAthenaPrintPolicy
Definition: Tracking/Acts/ActsInterop/ActsInterop/Logger.h:18
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:43
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7