ATLAS Offline Software
Loading...
Searching...
No Matches
asg::AsgMessaging Class Reference

Class mimicking the AthMessaging class from the offline software. More...

#include <AsgMessaging.h>

Inherits AthMessaging.

Inherited by HLT::TypedHolder< TrigRoiDescriptor, TrigRoiDescriptorCollection >, AtlasRoot::egammaEnergyCorrectionTool, CP::AsgxAODMetNTupleMakerAlg::ElementProcessor, CP::AsgxAODNTupleMakerAlg::ContainerProcessor, CP::AsgxAODNTupleMakerAlg::ElementProcessor, CP::IsoVariableHelper, CP::IsolationCondition, CP::IsolationCorrection, FEElectronHelper, FEMuonHelper, HLT::FullHolderFactory, HLT::TrigHolderStructure, HLT::TypedHolder< FEATURE, CONTAINER >, HLT::TypedHolder< TrigRoiDescriptor, TrigRoiDescriptorCollection >, InDet::SecVtxTrackAccessor, InDet::SecVtxTrackCut, JCT::HotCell, JetCalibrationStep, LArTemperatureCorrectionTool, LinearityADC, MinimalSumAssociation, ORUtils::MuJetGhostDRMatcher, ORUtils::ToolBox, PFSubtractionEnergyRatioCalculator, PFSubtractionStatusSetter, PanTau::HelperFunctions, ResidualOffsetCorrection, Ringer::onnx::RingerSelector, Root::TElectronEfficiencyCorrectionTool, Root::TElectronIsEMSelector, Root::TElectronLikelihoodTool, Root::TForwardElectronIsEMSelector, Root::TForwardElectronLikelihoodTool, Root::TPhotonIsEMSelector, TauGNN, TauGNNDataLoader, TauJetRNN, TauJetRNNUtils::VarCalc, Trig::MatchingImplementation, Trig::TrigBtagEmulationChain, TrigGlobEffCorr::Calculator, TrigGlobEffCorr::CheckConfig, TrigGlobEffCorr::ImportData, ZdcFileGeometryDB [private], ZdcGeoDBGeometryDB [private], ZdcInjPulserAmpMap, ZdcLucrodMapRun3, columnar::PythonToolHandle, eflowCellSubtractionFacilitator, egGain::GainUncertainty, egammaLayerRecalibTool, egammaMVAFunctions::ConversionHelper, get_MaterialResolutionEffect, jet::ConfigHelper [private], jet::CorrelationMatrix, jet::OptionHelper, jet::ResolutionHelper, jet::UncertaintyComponent, jet::UncertaintyGroup, jet::UncertaintyHistogram, jet::UncertaintySet [virtual], tauRecTools::BDTHelper, xAOD::Event, and xAOD::SimpleEncrypter.

Collaboration diagram for asg::AsgMessaging:

Public Member Functions

 AsgMessaging (const std::string &name)
 Constructor with a name.
 AsgMessaging (const INamedInterface *tool)
 Constructor with a tool pointer.
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Class mimicking the AthMessaging class from the offline software.

This class is supposed to provide a convenient way to provide messaging capabilities for classes that are not dual-use tools themselves. Such classes are encouraged to inherit from this one, and then print output messages using the "standard" messaging macros.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
615778
Date
2014-09-09 16:27:03 +0200 (Tue, 09 Sep 2014)

Definition at line 36 of file AsgMessaging.h.

Constructor & Destructor Documentation

◆ AsgMessaging() [1/2]

asg::AsgMessaging::AsgMessaging ( const std::string & name)

Constructor with a name.

Definition at line 17 of file AsgMessaging.cxx.

18 :
19#ifndef XAOD_STANDALONE
20 AthMessaging( Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc", false ),
21 name )
22#else // not XAOD_STANDALONE
23 m_msg( name )
24#endif // not XAOD_STANDALONE
25 {
26
27 }
AthMessaging()
Default constructor:

◆ AsgMessaging() [2/2]

asg::AsgMessaging::AsgMessaging ( const INamedInterface * tool)

Constructor with a tool pointer.

Definition at line 29 of file AsgMessaging.cxx.

30 :
31#ifndef XAOD_STANDALONE
32 AthMessaging( Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc", false ),
33 tool->name() )
34#else // not XAOD_STANDALONE
35 m_msg( tool )
36#endif // not XAOD_STANDALONE
37 {
38
39 }

Member Function Documentation

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level lvl) const

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level lvl) const

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46#endif // not XAOD_STANDALONE
47 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files: