24 "default:",
"default:",
"default:",
"default:",
25 "default:",
"default:",
"default:",
26 "default:verbose",
"default:verbose",
105 return instance()->get_stream(
s) ;
120 char key_buffer[64] ;
122 char *c = &(key_buffer[0]);
127 const char *env = ::getenv(key_buffer) ;
128 if (env!=0)
return env ;
129 const char* static_key = DEFAULT_STREAMS[
s] ;
130 if (static_key)
return static_key ;
144 std::string protocol ;
147 std::string::size_type colon =
key.find(
':') ;
148 if (colon==std::string::npos) {
151 protocol =
key.substr(0,colon) ;
152 std::string::size_type uri_start = colon+1 ;
153 if (uri_start<
key.size()) {
154 uri =
key.substr(uri_start) ;
157 for(stream_factory_collection::const_iterator pos=m_factories.begin();pos!=m_factories.end();++pos) {
158 create_stream_callback callback = pos->second;
159 Stream *
s = callback(protocol,uri);
162 fprintf(stderr,
"Warning, could not find stream for key protocol=\"%s\" uri=\"%s\" (%s)\n",protocol.c_str(),uri.c_str(),
key.c_str());
177 const char*
key = key_for_severity(
s);
178 return create_stream(
key);
189 dispatch(issue_ptr,
false);
199 dispatch(issue_ptr,
false);
209 dispatch(issue_ptr,
false);
222 dispatch(issue_ptr,
false);
256 if (throw_error && issue_ptr->
is_error()) {
throw *issue_ptr ; }
258 Stream *stream_ptr = instance()->get_stream(
s) ;
260 stream_ptr->
send(issue_ptr);
265 dispatch(&issue_ref,throw_error);
270 instance()->set(
s,
key.c_str()) ;
284 if (m_streams[
s]==0) {
285 m_streams[
s]=create_stream(
s) ;
287 return m_streams[
s] ;
302 if (m_streams[severity]) {
303 delete m_streams[severity] ;
305 m_streams[severity] =
s ;
349 return get_stream(
s) ;
369 m_factories[name] = callback ;
379 stream <<
"Stream factory - registered streams\n" ;
380 stream <<
"-----------------------------------\n" ;
382 for(stream_factory_collection::const_iterator pos=m_factories.begin();pos!=m_factories.end();++pos) {
383 std::string name = pos->first;
384 stream << i <<
")\t" << name << std::endl;
387 stream <<
"-----------------------------------\n" ;
#define ERS_PRE_CHECK_PTR(p)
#define ERS_NOT_IMPLEMENTED()
#define ERS_PRECONDITION(expr,...)
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Source context for Issue.
static const char * to_string(severity_t s)
severity_t to string
static const char *const KEY
severity_t severity() const
severity_t of the issue
bool is_error()
is the issue an error (or fatal).
Wrapper for log messages.
Factory for Stream objects and repository of default streams.
static const char * key_for_severity(severity_t s)
finds key for severity_t
static void set_stream(severity_t, const std::string &key)
Stream * create_stream(severity_t s)
create a stream for severity_t
Stream * warning()
Warning stream.
static void dispatch(Issue *i, bool throw_error=false)
Sends an issue to the appropriate stream according to its severity_t.
static Stream * get_default_stream(severity_t s)
builds default stream for severity_t
bool register_factory(const std::string &name, create_stream_callback callback)
register a factory method
static StreamFactory * s_instance
singleton instance
static const char * DEFAULT_STREAMS[]
keys for default streams
static void print_registered()
Stream * m_streams[severity_max]
array of pointers to streams per severity_t
static StreamFactory * instance()
return the singleton
Stream * fatal()
Fatal stream.
void set(severity_t severity, Stream *s)
Sets the stream for a given severity_t.
Stream * get_stream(severity_t s)
get stream for severity_t
void write_to(std::ostream &stream) const
write content of factory to stream
static void debug(Issue *i, severity_t)
sends an Issue to the debug stream
Stream * error()
Error stream.
virtual void send(const Issue *i)
Sends an issue into the stream.
ers header and documentation file
efhlt::Interface * factory(void)
std::ostream & operator<<(std::ostream &, const Issue &)
enum ers::_severity_t severity_t