3 #include "GaudiKernel/ISvcLocator.h"
4 #include "GaudiKernel/MsgStream.h"
5 #include "GaudiKernel/AttribStringParser.h"
6 #include "GaudiKernel/System.h"
7 #include "GaudiKernel/Time.h"
12 std::string getTraceBack() {
14 constexpr
int depth = 30;
15 constexpr
int offset = 5;
20 static const std::map<IssueSeverity::Level, MSG::Level> s_sevMsgMap =
34 static const std::map<IssueSeverity::Level, std::string> s_levelTrans =
47 static const std::map<std::string, IssueSeverity::Level> s_levelSTrans =
66 std::transform(s.begin(), s.end(), s.begin(),
78 declareProperty (
"ShowTime",
m_showTime=
false);
130 auto loc = ident.find(
" ");
131 using Parser = Gaudi::Utils::AttribStringParser;
133 for (
auto attrib: Parser(ident.substr(loc + 1))) {
143 log <<
MSG::ERROR <<
"Unknown output level \"" << attrib.tag <<
"\""
153 if (attrib.value ==
"MsgSvc") {
155 }
else if (attrib.value ==
"STDERR") {
157 }
else if (attrib.value ==
"STDOUT") {
163 catch (std::exception&) {
165 log <<
MSG::ERROR <<
"Unable to open file \"" << attrib.value
166 <<
"\" for writing issues at level " << attrib.tag <<
endmsg;
170 log <<
MSG::DEBUG <<
"Writing " << s_levelTrans.at(level)
180 const std::string& org) {
182 std::string
msg = s_levelTrans.at(lev) +
" " + org +
" \"" + str +
"\"";
204 <<
"to a StringProperty (which it should be!)" <<
endmsg;
208 const std::string& val = sap->
value();
210 if (s_levelSTrans.find(val) == s_levelSTrans.end()) {
213 log <<
MSG::ERROR <<
"Option " << prop.
name() <<
": unknown Issue Severity level \""
214 << val <<
"\". Setting it " << s_levelTrans.at(def) <<
endmsg;
216 key = s_levelSTrans.at(val);
220 if (prop.
name() ==
"ReportLevel") {
222 }
else if (prop.
name() ==
"TracebackLevel") {
226 log <<
MSG::ERROR <<
"setting up unknown property \""
240 <<
"to a StringArrayProperty (which it should be!)" <<
endmsg;
243 for (
const auto&
s : sap->
value() ) {
261 log <<
MSG::DEBUG <<
"Writing " << s_levelTrans.at(j)
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
StatusCode connect(const std::string &)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode finalize() override
std::string getOrigin() const
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
const std::string & name() const
property name
StatusCode finalize() override
void toupper(std::string &s)
static Time current(void)
Returns the current time.
bool isSuccess() const
Test for a status code of SUCCESS.
auto begin(reverse_wrapper< T > &w)
StringArrayProperty m_outputfile
IssueSeverity::Level m_reportLevel
bool isFailure() const
Test for a status code of FAILURE.
StringProperty m_reportLevelS
GAUDI_API int backTrace(void **addresses, const int depth)
void setupDefaultLogger()
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
#define DECLARE_COMPONENT(type)
StatusCode reinitialize() override
const TYPE & value() const
explicit conversion
std::array< logger_t, IssueSeverity::NUM_LEVELS > m_log
Property base class allowing Property* collections to be "homogeneous".
Base class used to extend a class implementing other interfaces.
void setupStreams(Property &prop)
void setupLevels(Property &prop)
StatusCode initialize() override
void WriteToMsgSvc(const std::string &str)
IssueSeverity::Level m_traceLevel
BooleanProperty m_showTime
IssueSeverity::Level getLevel() const
StringProperty m_traceLevelS
void WriteToStream(const std::string &str)
std::string getMsg() const
void report(IssueSeverity::Level level, const std::string &msg, const std::string &origin) override
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
IssueLogger(const std::string &name, ISvcLocator *svc)