31 int get_default_qualifiers( std::vector<std::string> & qualifiers )
33 static const char * environment = ::getenv(
"DUNEDAQ_ERS_QUALIFIERS" );
41 void add_default_qualifiers(
Issue & issue )
43 static std::vector<std::string> qualifiers;
45 get_default_qualifiers( qualifiers );
46 for ( std::vector<std::string>::const_iterator it = qualifiers.begin(); it != qualifiers.end(); ++it )
55 m_cause( other.m_cause.get() ? other.m_cause->clone() : 0 ),
56 m_context( other.m_context->clone() ),
57 m_message( other.m_message ),
58 m_qualifiers( other.m_qualifiers ),
59 m_severity( other.m_severity ),
60 m_time( other.m_time ),
61 m_values( other.m_values )
70 const std::string & message )
71 : m_context( context.clone() ),
74 m_time( system_clock::
now() )
77 add_default_qualifiers( *
this );
85 const std::exception & cause )
86 : m_context( context.clone() ),
88 m_time( system_clock::
now() )
93 add_default_qualifiers( *
this );
102 const std::string & message,
103 const std::exception & cause )
104 : m_context( context.clone() ),
105 m_message( message ),
107 m_time( system_clock::
now() )
112 add_default_qualifiers( *
this );
116 const system_clock::time_point & time,
118 const std::string & message,
119 const std::vector<std::string> & qualifiers,
120 const std::map<std::string, std::string> & parameters,
123 m_context( context.clone() ),
124 m_message( message ),
125 m_qualifiers( qualifiers ),
128 m_values( parameters )
137 return system_clock::to_time_t(
m_time);
143 string_map::const_iterator it =
m_values.find(key);
146 value = it->second.c_str();
150 throw ers::NoValue(
ERS_HERE, key );
157 string_map::const_iterator it =
m_values.find(key);
164 throw ers::NoValue(
ERS_HERE, key );
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
An abstract interface to access an Issue context.
Base class for any user define issue.
ers::Severity severity() const
severity of the issue
Severity m_severity
Issue's severity.
void wrap_message(const std::string &begin, const std::string &end)
std::unique_ptr< Context > m_context
Context of the current issue.
virtual ~Issue() noexcept
void prepend_message(const std::string &message)
system_clock::time_point m_time
Time when issue was thrown.
void get_value(const std::string &key, T &value) const
virtual Issue * clone() const =0
std::unique_ptr< const Issue > m_cause
Issue that caused the current issue.
string_map m_values
List of user defined attributes.
std::string m_message
Issue's explanation text.
void add_qualifier(const std::string &qualif)
adds a qualifier to the issue
const char * what() const noexcept
General cause of the issue.
ers::Severity set_severity(ers::Severity severity) const
std::time_t time_t() const
seconds since 1 Jan 1970
std::vector< std::string > m_qualifiers
List of associated qualifiers.
Issue(const Context &context, const std::string &message=std::string())
const Issue * cause() const
return the cause Issue of this Issue
caught dunedaq::conffwk::Exception exception
void tokenize(const std::string &text, const std::string &separators, std::vector< std::string > &tokens)
std::ostream & operator<<(std::ostream &, const ers::Configuration &)
static std::ostream & print(std::ostream &out, const Issue &issue, int verbosity)