IssueLogger Class Reference

#include <src/IssueLogger.h>

Inheritance diagram for IssueLogger:
Collaboration diagram for IssueLogger:

Public Member Functions

virtual StatusCode initialize ()
 Initialization (from CONFIGURED to INITIALIZED). More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode finalize ()
 Finalize (from INITIALIZED to CONFIGURED). More...
 
 IssueLogger (const std::string &name, ISvcLocator *svc)
 
void report (IssueSeverity::Level level, const std::string &msg, const std::string &origin)
 
void report (const IssueSeverity &err)
 
- Public Member Functions inherited from extends1< Service, IIssueLogger >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector< Property * > & getProperties () const
 Get list of properties. More...
 
virtual bool hasProperty (const std::string &name) const
 Return true if we have a property with the given name. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector< Property * > & getProperties () const
 Get list of properties. More...
 
virtual bool hasProperty (const std::string &name) const
 Return true if we have a property with the given name. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces1< IIssueLogger >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IIssueLogger
 DeclareInterfaceID (IIssueLogger, 2, 0)
 InterfaceID. More...
 
 DeclareInterfaceID (IIssueLogger, 2, 0)
 InterfaceID. More...
 

Protected Member Functions

virtual ~IssueLogger ()
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Member Functions

StatusCode connect (const std::string &)
 
void getTraceBack (std::string &stack)
 
MSG::Level sevToMsg (IssueSeverity::Level &lev)
 
IssueSeverity::Level msgToSev (MSG::Level &lev)
 
void setupDefaultLogger ()
 
void setupLevels (Property &prop)
 
void setupStreams (Property &prop)
 

Private Attributes

StringArrayProperty m_outputfile
 
StringProperty m_reportLevelS
 
StringProperty m_traceLevelS
 
BooleanProperty m_showTime
 
IssueSeverity::Level m_reportLevel
 
IssueSeverity::Level m_traceLevel
 
StreamLoggerm_logger [IssueSeverity::NUM_LEVELS]
 
boost::function< void(const std::string &)> m_log [IssueSeverity::NUM_LEVELS]
 
std::map< MSG::Level, IssueSeverity::Levelm_msgSevMap
 
std::map< IssueSeverity::Level, MSG::Levelm_sevMsgMap
 
std::map< IssueSeverity::Level, std::string > m_levelTrans
 
std::map< std::string, IssueSeverity::Levelm_levelSTrans
 

Additional Inherited Members

- Public Types inherited from extends1< Service, IIssueLogger >
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1< IIssueLoggerextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces1< IIssueLoggerextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3< IService, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces3< IService, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename IService::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef mpl::fold< typename IService::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces1< IIssueLogger >
typedef IIssueLogger::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef IIssueLogger::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Detailed Description

Definition at line 15 of file IssueLogger.h.

Constructor & Destructor Documentation

IssueLogger::IssueLogger ( const std::string &  name,
ISvcLocator svc 
)

Definition at line 28 of file IssueLogger.cpp.

29  : base_class(name, svc) {
30 
31  declareProperty ("Output", m_outputfile );
32  declareProperty ("ReportLevel", m_reportLevelS="WARNING");
33  declareProperty ("TracebackLevel", m_traceLevelS="ERROR");
34  declareProperty ("ShowTime", m_showTime=false);
35 
39 
42 
43  for (int i=0; i<IssueSeverity::NUM_LEVELS; ++i) {
44  m_logger[i] = 0;
45  }
46 
55 
68 
80 
92 
93 
94 }
std::map< IssueSeverity::Level, std::string > m_levelTrans
Definition: IssueLogger.h:46
std::map< std::string, IssueSeverity::Level > m_levelSTrans
Definition: IssueLogger.h:47
StringArrayProperty m_outputfile
Definition: IssueLogger.h:35
IssueSeverity::Level m_reportLevel
Definition: IssueLogger.h:39
extends1 base_class
Typedef to this class.
Definition: extends.h:12
StringProperty m_reportLevelS
Definition: IssueLogger.h:36
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
StreamLogger * m_logger[IssueSeverity::NUM_LEVELS]
Definition: IssueLogger.h:41
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
void setupStreams(Property &prop)
void setupLevels(Property &prop)
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:212
IssueSeverity::Level m_traceLevel
Definition: IssueLogger.h:39
std::map< IssueSeverity::Level, MSG::Level > m_sevMsgMap
Definition: IssueLogger.h:45
BooleanProperty m_showTime
Definition: IssueLogger.h:37
list i
Definition: ana.py:128
std::map< MSG::Level, IssueSeverity::Level > m_msgSevMap
Definition: IssueLogger.h:44
StringProperty m_traceLevelS
Definition: IssueLogger.h:36
IssueLogger::~IssueLogger ( )
protectedvirtual

Definition at line 98 of file IssueLogger.cpp.

98  {
99 
100 }

Member Function Documentation

StatusCode IssueLogger::connect ( const std::string &  ident)
private

Definition at line 157 of file IssueLogger.cpp.

157  {
158 
159  MsgStream log ( msgSvc(), name() );
160 
161  string::size_type loc = ident.find(" ");
162 // string stream = ident.substr(0,loc); // icc remark #177: variable "stream" was declared but never referenced
163 // typedef std::pair<std::string,std::string> Prop;
164 // std::vector<Prop> props;
165 
166  using Parser = Gaudi::Utils::AttribStringParser;
167  // note: if loc == string::npos then loc + 1 == 0
168  for (auto attrib: Parser(ident.substr(loc + 1))) {
169  toupper(attrib.tag);
170 
172 
173  if (attrib.tag == "DEBUG") {
174  level = IssueSeverity::DEBUG;
175  } else if ( attrib.tag == "INFO") {
176  level = IssueSeverity::INFO;
177  } else if ( attrib.tag == "WARNING") {
178  level = IssueSeverity::WARNING;
179  } else if ( attrib.tag == "RECOVERABLE") {
181  } else if ( attrib.tag == "ERROR") {
182  level = IssueSeverity::ERROR;
183  } else if ( attrib.tag == "FATAL") {
184  level = IssueSeverity::FATAL;
185  } else {
186  log << MSG::ERROR << "Unknown output level \"" << attrib.tag << "\""
187  << endmsg;
188  continue;
189  }
190 
191  if (m_logger[level] != 0) {
192  log << MSG::INFO << "closing stream " << m_logger[level]->name()
193  << endmsg;
194  delete m_logger[level];
195  m_logger[level] = 0;
196  }
197 
198  if (attrib.value == "MsgSvc") {
199  m_logger[level] = new StreamLogger(msgSvc(), m_sevMsgMap[level]);
200  m_log[level] =
201  boost::bind(&StreamLogger::WriteToMsgSvc, m_logger[level],
202  _1);
203  } else if (attrib.value == "STDERR") {
204  m_logger[level] = new StreamLogger(std::cerr);
205  m_log[level] =
206  boost::bind(&StreamLogger::WriteToStream, m_logger[level],
207  _1);
208  } else if (attrib.value == "STDOUT") {
209  m_logger[level] = new StreamLogger(std::cout);
210  m_log[level] =
211  boost::bind(&StreamLogger::WriteToStream, m_logger[level],
212  _1);
213  } else { // A file
214  try {
215  m_logger[level] = new StreamLogger(attrib.value.c_str());
216  }
217  catch (std::exception&) {
218  m_logger[level] = 0;
219  log << MSG::ERROR << "Unable to open file \"" << attrib.value
220  << "\" for writing issues at level " << attrib.tag << endmsg;
221  return StatusCode::FAILURE;
222  }
223  m_log[level] =
224  boost::bind(&StreamLogger::WriteToStream, m_logger[level], _1);
225  }
226  log << MSG::DEBUG << "Writing " << m_levelTrans[level]
227  << " issues to " << m_logger[level]->name() << endmsg;
228 
229  }
230 
231  return StatusCode::SUCCESS;
232 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::map< IssueSeverity::Level, std::string > m_levelTrans
Definition: IssueLogger.h:46
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void toupper(std::string &s)
Definition: IssueLogger.cpp:20
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
StreamLogger * m_logger[IssueSeverity::NUM_LEVELS]
Definition: IssueLogger.h:41
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
void WriteToMsgSvc(const std::string &str)
Definition: StreamLogger.h:22
boost::function< void(const std::string &)> m_log[IssueSeverity::NUM_LEVELS]
Definition: IssueLogger.h:42
std::string name() const
std::map< IssueSeverity::Level, MSG::Level > m_sevMsgMap
Definition: IssueLogger.h:45
void WriteToStream(const std::string &str)
Definition: StreamLogger.h:21
StatusCode IssueLogger::finalize ( )
virtual

Finalize (from INITIALIZED to CONFIGURED).

Reimplemented from Service.

Definition at line 132 of file IssueLogger.cpp.

132  {
133 
134  MsgStream log ( msgSvc(), name() );
135  log << MSG::DEBUG << "IssueLogger::finalize" << endmsg;
136 
137  for (int i=0; i<IssueSeverity::NUM_LEVELS; ++i) {
139  delete m_logger[j];
140  }
141 
142  return Service::finalize();
143 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
StreamLogger * m_logger[IssueSeverity::NUM_LEVELS]
Definition: IssueLogger.h:41
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
list i
Definition: ana.py:128
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:197
void IssueLogger::getTraceBack ( std::string &  stack)
private

Definition at line 148 of file IssueLogger.cpp.

148  {
149  const int depth = 30;
150  const int offset = 5;
151  System::backTrace(stack, depth, offset);
152 }
GAUDI_API int backTrace(void **addresses, const int depth)
StatusCode IssueLogger::initialize ( )
virtual

Initialization (from CONFIGURED to INITIALIZED).

Reimplemented from Service.

Definition at line 105 of file IssueLogger.cpp.

105  {
106 
108  if (st.isFailure()) { return st; }
109 
111 
112  return st;
113 
114 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
void setupDefaultLogger()
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:72
IssueSeverity::Level IssueLogger::msgToSev ( MSG::Level lev)
private
StatusCode IssueLogger::reinitialize ( )
virtual

Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).

Reimplemented from Service.

Definition at line 119 of file IssueLogger.cpp.

119  {
120 
121  MsgStream log ( msgSvc(), name() );
122  log << MSG::WARNING << "reinitialize not implemented" << endmsg;
123 
124 
125  return StatusCode::SUCCESS;
126 
127 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
void IssueLogger::report ( IssueSeverity::Level  level,
const std::string &  msg,
const std::string &  origin 
)
virtual

Implements IIssueLogger.

Definition at line 237 of file IssueLogger.cpp.

238  {
239 
240  if ( lev < m_reportLevel) return;
241 
242  std::string msg = m_levelTrans[lev] + " " + org + " \"" + str + "\"";
243 
244  if (m_showTime) {
245  msg += " [" + Gaudi::Time::current().format(true, "%H:%M:%S %Y/%m/%d %Z") +"]";
246  }
247 
248  if (lev >= m_traceLevel) {
249  std::string stack;
250  getTraceBack(stack);
251  msg += "\n" + stack;
252  }
253 
254 
255  m_log[lev](msg);
256 
257 
258 }
std::map< IssueSeverity::Level, std::string > m_levelTrans
Definition: IssueLogger.h:46
static Time current(void)
Returns the current time.
Definition: Time.cpp:114
IssueSeverity::Level m_reportLevel
Definition: IssueLogger.h:39
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
void getTraceBack(std::string &stack)
boost::function< void(const std::string &)> m_log[IssueSeverity::NUM_LEVELS]
Definition: IssueLogger.h:42
IssueSeverity::Level m_traceLevel
Definition: IssueLogger.h:39
BooleanProperty m_showTime
Definition: IssueLogger.h:37
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
Definition: Time.cpp:280
void IssueLogger::report ( const IssueSeverity err)
virtual

Implements IIssueLogger.

Definition at line 265 of file IssueLogger.cpp.

265  {
266 
267  report(err.getLevel(), err.getMsg(), err.getOrigin());
268 
269 }
std::string getOrigin() const
void report(IssueSeverity::Level level, const std::string &msg, const std::string &origin)
IssueSeverity::Level getLevel() const
Definition: IssueSeverity.h:82
std::string getMsg() const
Definition: IssueSeverity.h:83
void IssueLogger::setupDefaultLogger ( )
private

Definition at line 346 of file IssueLogger.cpp.

346  {
347  for (int i=1; i<IssueSeverity::NUM_LEVELS; ++i) {
348  if (m_logger[i] == 0) {
349  // default: dump to msgSvc
351 
352  m_logger[j] = new StreamLogger(msgSvc(), m_sevMsgMap[j]);
353  m_log[j] = boost::bind(&StreamLogger::WriteToMsgSvc, m_logger[j],
354  _1);
355 
356  MsgStream log ( msgSvc(), name() );
357  log << MSG::DEBUG << "Writing " << m_levelTrans[j]
358  << " issues to " << m_logger[j]->name() << endmsg;
359 
360  }
361  }
362 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::map< IssueSeverity::Level, std::string > m_levelTrans
Definition: IssueLogger.h:46
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
StreamLogger * m_logger[IssueSeverity::NUM_LEVELS]
Definition: IssueLogger.h:41
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
void WriteToMsgSvc(const std::string &str)
Definition: StreamLogger.h:22
boost::function< void(const std::string &)> m_log[IssueSeverity::NUM_LEVELS]
Definition: IssueLogger.h:42
std::string name() const
std::map< IssueSeverity::Level, MSG::Level > m_sevMsgMap
Definition: IssueLogger.h:45
list i
Definition: ana.py:128
void IssueLogger::setupLevels ( Property prop)
private

Definition at line 274 of file IssueLogger.cpp.

274  {
275 
276 
277  StringProperty *sap = dynamic_cast<StringProperty*> (&prop);
278  if (sap == 0) {
279  MsgStream log ( msgSvc(), name() );
280  log << MSG::ERROR << "Could not convert " << prop.name()
281  << "to a StringProperty (which it should be!)" << endmsg;
282  return;
283  }
284 
285  std::string val = sap->value();
286 
287  if (prop.name() == "ReportLevel") {
288  if (m_levelSTrans.find(val) == m_levelSTrans.end()) {
289  MsgStream log ( msgSvc(), name() );
290  log << MSG::ERROR
291  << "Option ReportLevel: unknown Issue Severity level \""
292  << val << "\". Setting it WARNING" << endmsg;
294  return;
295  } else {
297  }
298  } else if (prop.name() == "TracebackLevel") {
299  if (m_levelSTrans.find(val) == m_levelSTrans.end()) {
300  MsgStream log ( msgSvc(), name() );
301  log << MSG::ERROR
302  << "Option TracebackLevel: unknown Issue Severity level \""
303  << val << "\". Setting it to ERROR" << endmsg;
305  return;
306  } else {
308  }
309  } else {
310  MsgStream log ( msgSvc(), name() );
311  log << MSG::ERROR << "setting up unknown property \"" << prop.name()
312  << "\"" << endmsg;
313  return;
314  }
315 
316 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
const std::string & name() const
property name
Definition: Property.h:47
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
std::map< std::string, IssueSeverity::Level > m_levelSTrans
Definition: IssueLogger.h:47
IssueSeverity::Level m_reportLevel
Definition: IssueLogger.h:39
StringProperty m_reportLevelS
Definition: IssueLogger.h:36
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
IssueSeverity::Level m_traceLevel
Definition: IssueLogger.h:39
StringProperty m_traceLevelS
Definition: IssueLogger.h:36
void IssueLogger::setupStreams ( Property prop)
private

Definition at line 321 of file IssueLogger.cpp.

321  {
322 
323  StringArrayProperty *sap = dynamic_cast<StringArrayProperty*>( &prop );
324  if (sap == 0) {
325  MsgStream log ( msgSvc(), name() );
326  log << MSG::ERROR << "Could not convert " << prop.name()
327  << "to a StringArrayProperty (which it should be!)" << endmsg;
328  return;
329  }
330 
331  vector<string>::const_iterator itr;
332  for (itr = sap->value().begin(); itr != sap->value().end(); ++itr) {
333  if (connect(*itr).isFailure()) {
334  MsgStream log ( msgSvc(), name() );
335  log << MSG::ERROR << "Could not setup stream " << *itr << endmsg;
336  }
337  }
338 
339  return;
340 
341 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode connect(const std::string &)
const std::string & name() const
property name
Definition: Property.h:47
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
MSG::Level IssueLogger::sevToMsg ( IssueSeverity::Level lev)
private

Member Data Documentation

std::map<std::string, IssueSeverity::Level> IssueLogger::m_levelSTrans
private

Definition at line 47 of file IssueLogger.h.

std::map<IssueSeverity::Level, std::string> IssueLogger::m_levelTrans
private

Definition at line 46 of file IssueLogger.h.

boost::function<void (const std::string&)> IssueLogger::m_log[IssueSeverity::NUM_LEVELS]
private

Definition at line 42 of file IssueLogger.h.

StreamLogger* IssueLogger::m_logger[IssueSeverity::NUM_LEVELS]
private

Definition at line 41 of file IssueLogger.h.

std::map<MSG::Level, IssueSeverity::Level> IssueLogger::m_msgSevMap
private

Definition at line 44 of file IssueLogger.h.

StringArrayProperty IssueLogger::m_outputfile
private

Definition at line 35 of file IssueLogger.h.

IssueSeverity::Level IssueLogger::m_reportLevel
private

Definition at line 39 of file IssueLogger.h.

StringProperty IssueLogger::m_reportLevelS
private

Definition at line 36 of file IssueLogger.h.

std::map<IssueSeverity::Level, MSG::Level> IssueLogger::m_sevMsgMap
private

Definition at line 45 of file IssueLogger.h.

BooleanProperty IssueLogger::m_showTime
private

Definition at line 37 of file IssueLogger.h.

IssueSeverity::Level IssueLogger::m_traceLevel
private

Definition at line 39 of file IssueLogger.h.

StringProperty IssueLogger::m_traceLevelS
private

Definition at line 36 of file IssueLogger.h.


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