ATLAS Offline Software
Classes | Functions
Tracking/Acts/ActsInterop/ActsInterop/Logger.h File Reference
#include "Acts/Utilities/Logger.hpp"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/CommonMessaging.h"
#include "GaudiKernel/INamedInterface.h"
#include "AthenaBaseComps/AthMessaging.h"
#include "AthenaKernel/getMessageSvc.h"
#include <memory>
#include <optional>
Include dependency graph for Tracking/Acts/ActsInterop/ActsInterop/Logger.h:

Go to the source code of this file.

Classes

class  ActsAthenaPrintPolicy
 
class  ActsAthenaFilterPolicy
 

Functions

std::unique_ptr< const Acts::Logger > makeActsAthenaLogger (IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
 
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger (const CommonMessagingBase *parent, const std::string &name)
 
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger (const AthMessaging *parent, const std::string &name)
 
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger (const CommonMessagingBase *parent, const std::string &name, std::optional< std::string > parent_name)
 
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger (const CommonMessagingBase *parent, const std::string &name, const std::string &parent_name)
 

Function Documentation

◆ makeActsAthenaLogger() [1/5]

std::unique_ptr<const Acts::Logger> makeActsAthenaLogger ( const AthMessaging parent,
const std::string &  name 
)

Definition at line 81 of file Tracking/Acts/ActsInterop/src/Logger.cxx.

81  {
82  auto msg = std::make_shared<MsgStream>(parent->msg());
83  auto filter = std::make_unique<ActsAthenaFilterPolicy>(msg);
84  auto print = std::make_unique<ActsAthenaPrintPolicy>(msg, name);
85  return std::make_unique<const Acts::Logger>(std::move(print), std::move(filter));
86 }

◆ makeActsAthenaLogger() [2/5]

std::unique_ptr<const Acts::Logger> makeActsAthenaLogger ( const CommonMessagingBase *  parent,
const std::string &  name 
)

Definition at line 88 of file Tracking/Acts/ActsInterop/src/Logger.cxx.

89 {
90  // no explicit name, get from component
91  const INamedInterface *inamed = dynamic_cast<const INamedInterface*>(parent);
92  std::optional<std::string> parent_name = std::nullopt;
93  // this will not prefix if parent is not named (which it should be)
94  if (inamed == nullptr) {
95  throw std::invalid_argument("parent needs to be INamedInterface");
96  }
97  parent_name = inamed->name();
98  return makeActsAthenaLogger(parent, name, parent_name);
99 }

◆ makeActsAthenaLogger() [3/5]

std::unique_ptr<const Acts::Logger> makeActsAthenaLogger ( const CommonMessagingBase *  parent,
const std::string &  name,
const std::string &  parent_name 
)

Definition at line 113 of file Tracking/Acts/ActsInterop/src/Logger.cxx.

114 {
115 
116  return makeActsAthenaLogger(parent, name, std::optional<std::string>(parent_name));
117 }

◆ makeActsAthenaLogger() [4/5]

std::unique_ptr<const Acts::Logger> makeActsAthenaLogger ( const CommonMessagingBase *  parent,
const std::string &  name,
std::optional< std::string >  parent_name 
)

Definition at line 102 of file Tracking/Acts/ActsInterop/src/Logger.cxx.

103 {
104  int level = 0;
105  const INamedInterface *inamed = dynamic_cast<const INamedInterface*>(parent);
106  if (inamed != nullptr) {
107  level = parent->msg().level();
108  }
109  return makeActsAthenaLogger(parent->msgSvc().get(), name, level, parent_name);
110 }

◆ makeActsAthenaLogger() [5/5]

std::unique_ptr<const Acts::Logger> makeActsAthenaLogger ( IMessageSvc *  svc,
const std::string &  name,
int  level,
std::optional< std::string >  parent_name 
)

Definition at line 64 of file Tracking/Acts/ActsInterop/src/Logger.cxx.

65 {
66  using namespace Acts::Logging;
67 
68  std::string full_name = name;
69  if (parent_name) {
70  full_name = *parent_name + "." + full_name;
71  }
72 
73  auto msg = std::make_shared<MsgStream>(svc, full_name);
74  msg->setLevel(level);
75  auto filter = std::make_unique<ActsAthenaFilterPolicy>(msg);
76  auto print = std::make_unique<ActsAthenaPrintPolicy>(msg, full_name);
77  return std::make_unique<const Acts::Logger>(std::move(print), std::move(filter));
78 }
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
covarianceTool.filter
filter
Definition: covarianceTool.py:514
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:26
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7