22 int DAEstatus::add(
int facility,
int severity,
int errtype,
const std::string& text)
54 int DAEstatus::addVa(
int facility,
int severity,
int errtype,
const char* format, ... )
59 stat =
addVaMain(facility, severity, errtype, format, ap);
66 static const int maxlen = 10000;
69 len = _vscprintf(format, ap);
70 if ( (len >= 0) && (len < maxlen) )
72 buffer =
new char[len+1];
73 vsprintf(buffer, format, ap);
75 stat =
add(facility, severity, errtype, buffer);
80 stat =
add(facility, severity, errtype,
"<invalid vararg error message - probably too long in DAEstatus::addVaMain>");
110 va_start(ap, format);
125 va_start(ap, format);
133 status_list_t::iterator iter;
150 status_list_t::iterator iter;
170 status_list_t::iterator iter;
175 sev = iter->resetSeverityToAtMost(severity);
187 status_list_t::iterator iter;
192 sev = iter->resetSeverityToAtLeast(severity);
203 status_list_t::iterator iter;
208 if (iter->check(severity, direction))
217 if (reset_overall_severity)
224 int DAEstatus::report(
int severity,
int direction,
bool reset_overall_severity,
bool remove_messages)
231 status_list_t::iterator iter;
236 if (iter->check(severity, direction))
238 (*report_func)(*iter, report_func_arg);
253 if (reset_overall_severity)
260 int DAEstatus::report(std::ostream& str,
int severity,
int direction,
bool reset_overall_severity,
bool remove_messages)
275 Poco::StringTokenizer tokenizer(this->
str(),
"\r\n", Poco::StringTokenizer::TOK_IGNORE_EMPTY );
276 for (Poco::StringTokenizer::Iterator it = tokenizer.begin(); it != tokenizer.end(); ++it)
282 if ( it != tokenizer.begin() )
284 str << (add_cr ?
"\r\n" :
"\n");
286 str <<
timeStr(format_with_T) <<
" " << *it;
292 int facility,
const std::string& text) :
293 m_severity(severity), m_errtype(errtype),
294 m_facility(facility), m_text(text), m_time(0)
305 return left_sev == right_sev;
311 if ( (left_sev%2 == 0) && (right_sev %2 == 0) )
313 return left_sev <= right_sev;
315 else if (left_sev%2 == 0)
328 if ( (left_sev%2 == 0) && (right_sev %2 == 0) )
330 return left_sev >= right_sev;
332 else if (left_sev%2 == 0)
bool check(int severity, int direction) const
int addVa(int facility, int severity, int errtype, const char *format,...)
int clearAll(bool reset_overall_severity=true)
int report(int severity, int direction, bool reset_overall_severity=true, bool remove_messages=true)
static bool compareEQ(int left_sev, int right_sev)
int DAEreport_func_t(const DAEstatus_message &mess, void *arg)
int add(DAEstatus &dstatus, bool clear)
int addDebug(int facility, const std::string &text)
static bool compareLE(int left_sev, int right_sev)
DAEreport_func_t * m_report_func
int reportAll(bool reset_overall_severity=true, bool remove_messages=true)
void * m_report_copy_func_arg
int clear(int severity, int direction, bool reset_overall_severity=true)
std::ostream & print(std::ostream &str, bool format_with_T=false, bool add_cr=false) const
int addVaMain(int facility, int severity, int errtype, const char *format, va_list ap)
int addDebugVa(int facility, const char *format,...)
int addWarning(int facility, const std::string &text)
int resetSeverityToAtLeast(int severity)
status_list_t m_status_list
int addWarningVa(int facility, const char *format,...)
int recalculateSeverity()
std::ostream & print(std::ostream &str)
static bool compareGE(int left_sev, int right_sev)
static bool compare(int left_sev, int right_sev, int direction)
CRITICAL_SECTION m_critical
int addInfo(int facility, const std::string &text)
static int ostreamReportFunction(const DAEstatus_message &mess, void *arg)
int resetSeverityToAtMost(int severity)
bool m_report_immediately
std::string timeStr(bool format_with_T) const
int addInfoVa(int facility, const char *format,...)
DAEreport_func_t * m_report_copy_func