2 #include "RelationalAccess/MonitoringException.h"
3 #include "CoralBase/MessageStream.h"
4 #include "CoralKernel/Context.h"
5 #include "CoralKernel/IHandle.h"
16 : active( act ),
level( lvl ), stream()
32 Repository::const_iterator rit;
42 if( level == coral::monitor::Off )
54 Repository::const_iterator rit;
57 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::level", this->
name() );
59 return (*rit).second.level;
64 Repository::const_iterator rit;
67 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::active", this->
name() );
69 return (*rit).second.active;
74 Repository::iterator rit;
77 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::enable", this->
name() );
79 (*rit).second.active =
true;
84 Repository::iterator rit;
87 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::disable", this->
name() );
89 (*rit).second.active =
false;
95 Repository::iterator rit;
98 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::record", this->
name() );
100 bool active = (*rit).second.active;
105 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description ) );
111 Repository::iterator rit;
114 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::record", this->
name() );
116 bool active = (*rit).second.active;
121 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description, data ) );
127 Repository::iterator rit;
130 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::record", this->
name() );
132 bool active = (*rit).second.active;
137 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description, data ) );
143 Repository::iterator rit;
146 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::record", this->
name() );
148 bool active = (*rit).second.active;
153 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description, data ) );
159 Repository::iterator rit;
162 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::record", this->
name() );
164 bool active = (*rit).second.active;
169 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description, data ) );
175 return( static_cast<const coral::IMonitoringReporter&>(*
this) );
186 Repository::const_iterator rit;
187 coral::MessageStream
log(
"MonitoringService" );
196 Repository::const_iterator rit;
199 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::record", this->
name() );
202 coral::MessageStream
log(
"MonitoringService" );
209 Repository::const_iterator rit;
212 throw coral::MonitoringException(
"Monitoring for session " + contextKey +
" not initialized...",
"MonitoringService::record", this->
name() );
215 coral::MessageStream
log(
"MonitoringService" );
222 if(it->m_source == coral::monitor::Statement)
224 os << (*it).m_description <<
";"<< std::endl;
231 if(it->m_source == coral::monitor::Statement)
233 os << (*it).m_description <<coral::MessageStream::flush;
241 for( EventStream::const_iterator evit = evsref.begin(); evit != evsref.end(); ++evit )
251 for( EventStream::const_iterator evit = evsref.begin(); evit != evsref.end(); ++evit )
SQLMonitoringService(const std::string &)
virtual void disable(const std::string &contextKey)
void reportOnEvent(EventStream::const_iterator &it, std::ostream &os) const
virtual ~SQLMonitoringService()
#define DEFINE_CORALSERVICE(type, name)
virtual void record(const std::string &contextKey, coral::monitor::Source source, coral::monitor::Type type, const std::string &description)
virtual void reportToOutputStream(const std::string &contextKey, std::ostream &os, unsigned int level) const
virtual std::set< std::string > monitoredDataSources() const
virtual void report(unsigned int level) const
virtual void setLevel(const std::string &contextKey, coral::monitor::Level level)
std::vector< coral::monitor::Event::Record > EventStream
The raw stream of recorder monitoring events.
virtual const coral::IMonitoringReporter & reporter() const
The session related book-keeping of monitored events.
Log< T >::type log(const T &t)
virtual void enable(const std::string &contextKey)
Repository m_events
The all events repository classified by the sessions' keys.
void reportForSession(Repository::const_iterator &it, std::ostream &os) const
virtual coral::monitor::Level level(const std::string &contextKey) const
virtual bool active(const std::string &contextKey) const
std::set< std::string > m_monitoredDS