1 #include "messagefacility/Utilities/MessageFacilityMsg.h"
2 #include "messagefacility/Utilities/ELseverityLevel.h"
4 #include "mfextensions/Binaries/qt_mf_msg.hh"
8 size_t qt_mf_msg::sequence = 0;
15 , host_(QString(msg.hostname().substr(0, msg.hostname().find_first_of(
'.')).c_str()))
16 , cat_(QString(msg.category().c_str()))
17 , app_(QString((msg.application() +
" (" + std::to_string(msg.pid()) +
")").c_str()))
18 , time_(msg.timestamp())
21 mf::ELseverityLevel severity(msg.severity());
22 int sevid = severity.getLevel();
24 text_ = QString(
"<font color=");
28 # if MESSAGEFACILITY_HEX_VERSION < 0x20002 // v2_00_02 is s50, pre v2_00_02 is s48
29 case mf::ELseverityLevel::ELsev_incidental:
31 case mf::ELseverityLevel::ELsev_success:
32 case mf::ELseverityLevel::ELsev_zeroSeverity:
33 case mf::ELseverityLevel::ELsev_unspecified:
35 text_ += QString(
"#505050>");
36 color_.setRgb(80, 80, 80);
39 case mf::ELseverityLevel::ELsev_info:
41 text_ += QString(
"#008000>");
42 color_.setRgb(0, 128, 0);
45 case mf::ELseverityLevel::ELsev_warning:
46 # if MESSAGEFACILITY_HEX_VERSION < 0x20002 // v2_00_02 is s50, pre v2_00_02 is s48
47 case mf::ELseverityLevel::ELsev_warning2:
50 text_ += QString(
"#E08000>");
51 color_.setRgb(224, 128, 0);
54 case mf::ELseverityLevel::ELsev_error:
55 # if MESSAGEFACILITY_HEX_VERSION < 0x20002 // v2_00_02 is s50, pre v2_00_02 is s48
56 case mf::ELseverityLevel::ELsev_error2:
57 case mf::ELseverityLevel::ELsev_next:
58 case mf::ELseverityLevel::ELsev_severe2:
59 case mf::ELseverityLevel::ELsev_abort:
60 case mf::ELseverityLevel::ELsev_fatal:
62 case mf::ELseverityLevel::ELsev_severe:
63 case mf::ELseverityLevel::ELsev_highestSeverity:
65 text_ += QString(
"#FF0000>");
66 color_.setRgb(255, 0, 0);
72 shortText_ = QString(text_);
73 shortText_ += QString(
"<pre style=\"margin-top: 0; margin-bottom: 0;\">");
74 shortText_ += QString(msg.message().c_str()).trimmed().toHtmlEscaped();
75 shortText_ += QString(
"</pre></font>");
78 text_ += QString(
"<pre>")
79 + QString(severity.getName().c_str()).toHtmlEscaped() +
" / "
80 + QString(msg.category().c_str()).toHtmlEscaped() +
"<br>"
81 + QString(msg.timestr().c_str()).toHtmlEscaped() +
"<br>"
82 + QString(msg.hostname().c_str()).toHtmlEscaped() +
" ("
83 + QString(msg.hostaddr().c_str()).toHtmlEscaped() +
")<br>"
84 # if MESSAGEFACILITY_HEX_VERSION < 0x20002 // v2_00_02 is s50, pre v2_00_02 is s48
85 + QString(msg.process().c_str()).toHtmlEscaped()
88 + QString::number(msg.pid()) +
")";
90 if (msg.file().compare(
"--"))
91 text_ += QString(
" / ") + QString(msg.file().c_str()).toHtmlEscaped()
92 + QString(
":") + QString::number(msg.line());
94 text_ += QString(
"<br>")
95 + QString(msg.application().c_str()).toHtmlEscaped() +
" / "
96 + QString(msg.module().c_str()).toHtmlEscaped() +
" / "
97 + QString(msg.context().c_str()).toHtmlEscaped() +
"<br>"
98 + QString(msg.message().c_str()).toHtmlEscaped()
101 text_ += QString(
"</font>");
qt_mf_msg(mf::MessageFacilityMsg const &msg)
Construct a qt_mf_msg using the given MessageFacilityMsg