ATLAS Offline Software
Functions
Tracking/Acts/ActsInterop/src/Logger.cxx File Reference
#include "ActsInterop/Logger.h"
#include "ActsInterop/LoggerUtils.h"
#include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/CommonMessaging.h"
#include "GaudiKernel/IMessageSvc.h"
#include "GaudiKernel/MsgStream.h"
#include "Acts/Utilities/Logger.hpp"
#include <optional>
#include <iostream>
#include <string>

Go to the source code of this file.

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 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/4]

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

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

82 {
83  // no explicit name, get from component
84  const INamedInterface *inamed = dynamic_cast<const INamedInterface*>(parent);
85  std::optional<std::string> parent_name = std::nullopt;
86  // this will not prefix if parent is not named (which it should be)
87  if (inamed == nullptr) {
88  throw std::invalid_argument("parent needs to be INamedInterface");
89  }
90  parent_name = inamed->name();
91  return makeActsAthenaLogger(parent, name, parent_name);
92 }

◆ makeActsAthenaLogger() [2/4]

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

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

107 {
108 
109  return makeActsAthenaLogger(parent, name, std::optional<std::string>(parent_name));
110 }

◆ makeActsAthenaLogger() [3/4]

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

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

96 {
97  int level = 0;
98  const INamedInterface *inamed = dynamic_cast<const INamedInterface*>(parent);
99  if (inamed != nullptr) {
100  level = parent->msg().level();
101  }
102  return makeActsAthenaLogger(parent->msgSvc().get(), name, level, parent_name);
103 }

◆ makeActsAthenaLogger() [4/4]

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>(svc, 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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7