Gaudi Framework, version v23r7

Home   Generated: Wed Mar 20 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
IssueLogger Class Reference

#include <IssueLogger.h>

Inheritance diagram for IssueLogger:
Inheritance graph
[legend]
Collaboration diagram for IssueLogger:
Collaboration graph
[legend]

Public Member Functions

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

Protected Member Functions

virtual ~IssueLogger ()
 

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::Level
m_msgSevMap
 
std::map< IssueSeverity::Level,
MSG::Level
m_sevMsgMap
 
std::map< IssueSeverity::Level,
std::string
m_levelTrans
 
std::map< std::string,
IssueSeverity::Level
m_levelSTrans
 

Friends

class SvcFactory< IssueLogger >
 

Additional Inherited Members

- Public Types inherited from extends1< Service, IIssueLogger >
typedef extends1 base_class
 Typedef to this class.
 
typedef extend_interfaces1
< IIssueLogger
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level.
 
Gaudi::StateMachine::State m_state
 Service state.
 
Gaudi::StateMachine::State m_targetState
 Service state.
 

Detailed Description

Definition at line 17 of file IssueLogger.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file IssueLogger.cpp.

: base_class(name, svc) {
declareProperty ("ReportLevel", m_reportLevelS="WARNING");
declareProperty ("TracebackLevel", m_traceLevelS="ERROR");
declareProperty ("ShowTime", m_showTime=false);
for (int i=0; i<IssueSeverity::NUM_LEVELS; ++i) {
m_logger[i] = 0;
}
}
IssueLogger::~IssueLogger ( )
protectedvirtual

Definition at line 99 of file IssueLogger.cpp.

{
}

Member Function Documentation

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

Definition at line 158 of file IssueLogger.cpp.

{
Tokenizer tok(true);
string::size_type loc = ident.find(" ");
// string stream = ident.substr(0,loc); // icc remark #177: variable "stream" was declared but never referenced
// typedef std::pair<std::string,std::string> Prop;
// std::vector<Prop> props;
string val,VAL,TAG,filename;
tok.analyse(ident.substr(loc+1,ident.length()), " ", "", "", "=", "'", "'");
for ( Tokenizer::Items::iterator i = tok.items().begin();
i != tok.items().end(); i++) {
const std::string& tag = (*i).tag();
TAG = tag;
toupper(TAG);
val = (*i).value();
VAL = val;
toupper(VAL);
if (TAG == "DEBUG") {
} else if ( TAG == "INFO") {
} else if ( TAG == "WARNING") {
} else if ( TAG == "RECOVERABLE") {
} else if ( TAG == "ERROR") {
} else if ( TAG == "FATAL") {
} else {
log << MSG::ERROR << "Unknown output level \"" << TAG << "\""
<< endmsg;
continue;
}
if (m_logger[level] != 0) {
log << MSG::INFO << "closing stream " << m_logger[level]->name()
<< endmsg;
delete m_logger[level];
}
if (val == "MsgSvc") {
boost::bind(&StreamLogger::WriteToMsgSvc, m_logger[level],
_1);
} else if (val == "STDERR") {
boost::bind(&StreamLogger::WriteToStream, m_logger[level],
_1);
} else if (val == "STDOUT") {
boost::bind(&StreamLogger::WriteToStream, m_logger[level],
_1);
} else { // A file
try {
m_logger[level] = new StreamLogger(val.c_str());
}
catch (std::exception&) {
log << MSG::ERROR << "Unable to open file \"" << VAL
<< "\" for writing issues at level " << TAG << endmsg;
}
boost::bind(&StreamLogger::WriteToStream, m_logger[level], _1);
}
log << MSG::DEBUG << "Writing " << m_levelTrans[level]
<< " issues to " << m_logger[level]->name() << endmsg;
}
}
StatusCode IssueLogger::finalize ( )
virtual

Reimplemented from Service.

Definition at line 133 of file IssueLogger.cpp.

{
log << MSG::DEBUG << "IssueLogger::finalize" << endmsg;
for (int i=0; i<IssueSeverity::NUM_LEVELS; ++i) {
delete m_logger[j];
}
}
void IssueLogger::getTraceBack ( std::string stack)
private

Definition at line 149 of file IssueLogger.cpp.

{
const int depth = 30;
const int offset = 5;
System::backTrace(stack, depth, offset);
}
StatusCode IssueLogger::initialize ( )
virtual

Reimplemented from Service.

Definition at line 106 of file IssueLogger.cpp.

{
if (st.isFailure()) { return st; }
return st;
}
IssueSeverity::Level IssueLogger::msgToSev ( MSG::Level lev)
private
StatusCode IssueLogger::reinitialize ( )
virtual

Reimplemented from Service.

Definition at line 120 of file IssueLogger.cpp.

{
log << MSG::WARNING << "reinitialize not implemented" << endmsg;
}
void IssueLogger::report ( IssueSeverity::Level  level,
const std::string msg,
const std::string origin 
)
virtual

Implements IIssueLogger.

Definition at line 247 of file IssueLogger.cpp.

{
if ( lev < m_reportLevel) return;
std::string msg = m_levelTrans[lev] + " " + org + " \"" + str + "\"";
if (m_showTime) {
msg += " [" + Gaudi::Time::current().format(true, "%H:%M:%S %Y/%m/%d %Z") +"]";
}
if (lev >= m_traceLevel) {
getTraceBack(stack);
msg += "\n" + stack;
}
m_log[lev](msg);
}
void IssueLogger::report ( const IssueSeverity err)
virtual

Implements IIssueLogger.

Definition at line 275 of file IssueLogger.cpp.

{
report(err.getLevel(), err.getMsg(), err.getOrigin());
}
void IssueLogger::setupDefaultLogger ( )
private

Definition at line 356 of file IssueLogger.cpp.

{
for (int i=1; i<IssueSeverity::NUM_LEVELS; ++i) {
if (m_logger[i] == 0) {
// default: dump to msgSvc
_1);
log << MSG::DEBUG << "Writing " << m_levelTrans[j]
<< " issues to " << m_logger[j]->name() << endmsg;
}
}
}
void IssueLogger::setupLevels ( Property prop)
private

Definition at line 284 of file IssueLogger.cpp.

{
StringProperty *sap = dynamic_cast<StringProperty*> (&prop);
if (sap == 0) {
log << MSG::ERROR << "Could not convert " << prop.name()
<< "to a StringProperty (which it should be!)" << endmsg;
return;
}
std::string val = sap->value();
if (prop.name() == "ReportLevel") {
<< "Option ReportLevel: unknown Issue Severity level \""
<< val << "\". Setting it WARNING" << endmsg;
return;
} else {
}
} else if (prop.name() == "TracebackLevel") {
<< "Option TracebackLevel: unknown Issue Severity level \""
<< val << "\". Setting it to ERROR" << endmsg;
return;
} else {
}
} else {
log << MSG::ERROR << "setting up unknown property \"" << prop.name()
<< "\"" << endmsg;
return;
}
}
void IssueLogger::setupStreams ( Property prop)
private

Definition at line 331 of file IssueLogger.cpp.

{
StringArrayProperty *sap = dynamic_cast<StringArrayProperty*>( &prop );
if (sap == 0) {
log << MSG::ERROR << "Could not convert " << prop.name()
<< "to a StringArrayProperty (which it should be!)" << endmsg;
return;
}
for (itr = sap->value().begin(); itr != sap->value().end(); ++itr) {
if (connect(*itr).isFailure()) {
log << MSG::ERROR << "Could not setup stream " << *itr << endmsg;
}
}
return;
}
MSG::Level IssueLogger::sevToMsg ( IssueSeverity::Level lev)
private

Friends And Related Function Documentation

friend class SvcFactory< IssueLogger >
friend

Definition at line 20 of file IssueLogger.h.

Member Data Documentation

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

Definition at line 51 of file IssueLogger.h.

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

Definition at line 50 of file IssueLogger.h.

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

Definition at line 46 of file IssueLogger.h.

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

Definition at line 45 of file IssueLogger.h.

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

Definition at line 48 of file IssueLogger.h.

StringArrayProperty IssueLogger::m_outputfile
private

Definition at line 39 of file IssueLogger.h.

IssueSeverity::Level IssueLogger::m_reportLevel
private

Definition at line 43 of file IssueLogger.h.

StringProperty IssueLogger::m_reportLevelS
private

Definition at line 40 of file IssueLogger.h.

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

Definition at line 49 of file IssueLogger.h.

BooleanProperty IssueLogger::m_showTime
private

Definition at line 41 of file IssueLogger.h.

IssueSeverity::Level IssueLogger::m_traceLevel
private

Definition at line 43 of file IssueLogger.h.

StringProperty IssueLogger::m_traceLevelS
private

Definition at line 40 of file IssueLogger.h.


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

Generated at Wed Mar 20 2013 17:59:46 for Gaudi Framework, version v23r7 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004