ATLAS Offline Software
Loading...
Searching...
No Matches
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
17class ActsAthenaPrintPolicy final : public Acts::Logging::OutputPrintPolicy
18{
19public:
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
34private:
35 IMessageSvc* m_svc{};
36 std::shared_ptr<MsgStream> m_msg{};
37 std::string m_name{};
38};
39
40class ActsAthenaFilterPolicy final : public Acts::Logging::OutputFilterPolicy {
41public:
42 ActsAthenaFilterPolicy(std::shared_ptr<MsgStream> msg) : m_msg(std::move(msg)) {}
43
44 bool doPrint(const Acts::Logging::Level& lvl) const override;
45
46 virtual
47 Acts::Logging::Level
48 level() const override;
49
50 virtual
51 std::unique_ptr<Acts::Logging::OutputFilterPolicy>
52 clone(Acts::Logging::Level level) const override;
53
54private:
55 std::shared_ptr<MsgStream> m_msg;
56};
57
58
59std::unique_ptr<const Acts::Logger>
60makeActsAthenaLogger(IMessageSvc *svc, const std::string& name,
61 int level, std::optional<std::string> parent_name);
62
63std::unique_ptr<const Acts::Logger>
64makeActsAthenaLogger(const CommonMessagingBase* parent, const std::string& name);
65
66std::unique_ptr<const Acts::Logger>
67makeActsAthenaLogger(const AthMessaging* parent, const std::string& name);
68
69std::unique_ptr<const Acts::Logger>
70makeActsAthenaLogger(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
74std::unique_ptr<const Acts::Logger>
75makeActsAthenaLogger(const CommonMessagingBase* parent, const std::string& name,
76 const std::string& parent_name);
77
78
79
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
virtual Acts::Logging::Level level() const override
ActsAthenaFilterPolicy(std::shared_ptr< MsgStream > msg)
virtual std::unique_ptr< Acts::Logging::OutputFilterPolicy > clone(Acts::Logging::Level level) const override
bool doPrint(const Acts::Logging::Level &lvl) const override
virtual const std::string & name() const override
virtual std::unique_ptr< Acts::Logging::OutputPrintPolicy > clone(const std::string &name) const override
void flush(const Acts::Logging::Level &lvl, const std::string &input) override
ActsAthenaPrintPolicy(std::shared_ptr< MsgStream > msg, const std::string &name)
Class to provide easy MsgStream access and capabilities.
singleton-like access to IMessageSvc via open function and helper
STL namespace.
MsgStream & msg
Definition testRead.cxx:32