| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

IssueLogger.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_ISSUELOGGER_H
2 #define GAUDISVC_ISSUELOGGER_H
3
4 #include "GaudiKernel/IIssueLogger.h"
5 #include "GaudiKernel/IssueSeverity.h"
6 #include "GaudiKernel/Property.h"
7 #include "GaudiKernel/Service.h"
8 #include "StreamLogger.h"
9 #include <map>
10 #include <string>
11 #include <vector>
12
13 class IssueLogger : public extends<Service, IIssueLogger>
14 {
15 public:
16 IssueLogger( const std::string& name, ISvcLocator* svc );
17 ~IssueLogger() override = default;
18
19 StatusCode initialize() override;
20 StatusCode reinitialize() override;
21 StatusCode finalize() override;
22
23 void report( IssueSeverity::Level level, const std::string& msg, const std::string& origin ) override;
24 void report( const IssueSeverity& err ) override;
25
26 private:
27 Gaudi::Property<std::vector<std::string>> m_outputfile{this, "Output"};
28 Gaudi::Property<std::string> m_reportLevelS{this, "ReportLevel", "WARNING"};
29 Gaudi::Property<std::string> m_traceLevelS{this, "TracebackLevel", "ERROR"};
30 Gaudi::Property<bool> m_showTime{this, "ShowTime", false};
31
32 IssueSeverity::Level m_reportLevel, m_traceLevel;
33
34 class logger_t final
35 {
36 std::unique_ptr<StreamLogger> m_logger;
37 void ( StreamLogger::*m_fun )( const std::string& ) = nullptr;
38
39 public:
40 logger_t() = default;
41 logger_t( StreamLogger* logger, void ( StreamLogger::*fun )( const std::string& ) ) : m_logger{logger}, m_fun{fun}
42 {
43 }
44 void operator()( const std::string& s ) const { ( m_logger.get()->*m_fun )( s ); }
45 const std::string& name() const { return m_logger->name(); }
46 explicit operator bool() const { return bool( m_logger ); }
47 void reset() { m_logger.reset(); }
48 };
49 std::array<logger_t, IssueSeverity::NUM_LEVELS> m_log;
50
51 StatusCode connect( const std::string& );
52 void setupDefaultLogger();
53 void setupLevels( Gaudi::Details::PropertyBase& prop );
54 void setupStreams( Gaudi::Details::PropertyBase& prop );
55 };
56
57 #endif
StreamLogger
Definition: StreamLogger.h:11
IssueLogger::logger_t::m_fun
void(StreamLogger::* m_fun)(const std::string &)
Definition: IssueLogger.h:37
CommonMessagingBase::msg
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:132
IssueLogger::connect
StatusCode connect(const std::string &)
Definition: IssueLogger.cpp:98
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IssueSeverity
Definition: IssueSeverity.h:42
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
IssueLogger::logger_t::logger_t
logger_t()=default
IssueLogger::setupStreams
void setupStreams(Gaudi::Details::PropertyBase &prop)
Definition: IssueLogger.cpp:199
IssueLogger::finalize
StatusCode finalize() override
Definition: IssueLogger.cpp:88
IssueLogger::~IssueLogger
~IssueLogger() override=default
IssueLogger::setupLevels
void setupLevels(Gaudi::Details::PropertyBase &prop)
Definition: IssueLogger.cpp:167
Gaudi::Functional::void
class MergingTransformer< Out(const vector_of_const_< In > void
Definition: MergingTransformer.h:19
IssueLogger::m_reportLevel
IssueSeverity::Level m_reportLevel
Definition: IssueLogger.h:32
IssueLogger::logger_t::m_logger
std::unique_ptr< StreamLogger > m_logger
Definition: IssueLogger.h:36
CommonMessagingBase::err
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:114
IssueLogger::logger_t::operator()
void operator()(const std::string &s) const
Definition: IssueLogger.h:44
StreamLogger::name
const std::string & name() const
Definition: StreamLogger.h:17
Gaudi::PluginService::Details::logger
GAUDIPS_API Logger & logger()
Return the current logger instance.
Definition: PluginService.cpp:344
std::string
STL class.
Service.h
IssueLogger::setupDefaultLogger
void setupDefaultLogger()
Definition: IssueLogger.cpp:217
IssueLogger::logger_t
Definition: IssueLogger.h:34
IssueSeverity::Level
Level
Definition: IssueSeverity.h:46
IIssueLogger.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IssueSeverity.h
IssueLogger::m_showTime
Gaudi::Property< bool > m_showTime
Definition: IssueLogger.h:30
std::unique_ptr::reset
T reset(T...args)
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
IssueLogger::reinitialize
StatusCode reinitialize() override
Definition: IssueLogger.cpp:79
IssueLogger::logger_t::reset
void reset()
Definition: IssueLogger.h:47
std::unique_ptr::get
T get(T...args)
IssueLogger::logger_t::name
const std::string & name() const
Definition: IssueLogger.h:45
IssueLogger
Definition: IssueLogger.h:13
StreamLogger.h
std::unique_ptr< StreamLogger >
IssueLogger::m_log
std::array< logger_t, IssueSeverity::NUM_LEVELS > m_log
Definition: IssueLogger.h:49
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
IssueLogger::initialize
StatusCode initialize() override
Definition: IssueLogger.cpp:67
Property.h
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
IssueLogger::logger_t::logger_t
logger_t(StreamLogger *logger, void(StreamLogger::*fun)(const std::string &))
Definition: IssueLogger.h:41
IssueLogger::m_outputfile
Gaudi::Property< std::vector< std::string > > m_outputfile
Definition: IssueLogger.h:27
gaudirun.s
string s
Definition: gaudirun.py:245
std::array
STL class.
gaudirun.level
level
Definition: gaudirun.py:261
IssueLogger::m_traceLevelS
Gaudi::Property< std::string > m_traceLevelS
Definition: IssueLogger.h:29
IssueLogger::m_traceLevel
IssueSeverity::Level m_traceLevel
Definition: IssueLogger.h:32
IssueLogger::report
void report(IssueSeverity::Level level, const std::string &msg, const std::string &origin) override
Definition: IssueLogger.cpp:152
IssueLogger::m_reportLevelS
Gaudi::Property< std::string > m_reportLevelS
Definition: IssueLogger.h:28
IssueLogger::IssueLogger
IssueLogger(const std::string &name, ISvcLocator *svc)
Definition: IssueLogger.cpp:54