235 {
236 ers::Severity sev = issue.
severity();
237 uint8_t lvl_ = TLVL_DEBUG;
240 lvl_ = TLVL_DEBUG + sev.
rank;
241 break;
243 lvl_ = TLVL_LOG;
244 break;
246 lvl_ = TLVL_INFO;
247 break;
249 lvl_ = TLVL_WARNING;
250 break;
252 lvl_ = TLVL_ERROR;
253 break;
255 lvl_ = TLVL_FATAL;
256 break;
257 }
258 struct
259 {
260 char tn[TRACE_TN_BUFSZ];
261 } _trc_;
263 if (traceControl_rwp->mode.bits.M && (traceLvls_p[traceTID].M & TLVLMSK(lvl_))) {
264 struct timeval lclTime;
265 std::chrono::system_clock::time_point tp{ issue.
ptime() };
266
267 std::chrono::microseconds micros = std::chrono::duration_cast<std::chrono::microseconds>(tp.time_since_epoch());
268 lclTime.tv_sec = micros.count() / 1000000;
269 lclTime.tv_usec = micros.count() % 1000000;
271 std::string complete_message = issue.
message();
272 const ers::Issue* issp = &issue;
273 while ((issp = issp->
cause())) {
274 char fbuf[0x100], tbuf[0x40];
275 int strip_ns = 1;
277 std::chrono::milliseconds millis =
278 std::chrono::duration_cast<std::chrono::milliseconds>(tp.time_since_epoch());
279 struct tm tm_s;
280 time_t secs = millis.count() / 1000;
281 localtime_r(&secs, &tm_s);
282 if (strftime(tbuf, sizeof(tbuf), "%Y-%b-%d %H:%M:%S", &tm_s) == 0)
283 tbuf[0] = '\0';
284 complete_message += "\n\tcaused by: " + std::string(tbuf);
285 int milliseconds = millis.count() % 1000;
286 sprintf(tbuf, ",%03d ", milliseconds);
287 complete_message += std::string(tbuf);
292 }
293 trace(&lclTime,
294 traceID,
295 lvl_,
298 0 TRACE_XTRA_PASSED,
299 complete_message.c_str());
300 }
301 }
303 }
virtual int line_number() const =0
virtual const char * file_name() const =0
virtual const char * function_name() const =0
const Context & context() const
Context of the issue.
ers::Severity severity() const
severity of the issue
const system_clock::time_point & ptime() const
original time point of the issue
const std::string & message() const
General cause of the issue.
const Issue * cause() const
return the cause Issue of this Issue
virtual void write(const Issue &issue)=0
std::string to_string(severity s)