1 #ifndef MESSAGEFACILITY_EXTENSIONS_QT_MF_MSG_H
2 #define MESSAGEFACILITY_EXTENSIONS_QT_MF_MSG_H
7 #include <QtCore/QString>
8 #include <QtGui/QColor>
16 #include "messagefacility/Utilities/ELseverityLevel.h"
25 enum sev_code_t { SDEBUG, SINFO, SWARNING, SERROR };
40 qt_mf_msg(std::string hostname, std::string category, std::string application, pid_t pid, timeval
time);
55 QString
const&
text(
bool mode)
const {
return mode ? shortText_ : text_; }
60 QColor
const&
color()
const {
return color_; }
65 sev_code_t
sev()
const {
return sev_; }
70 QString
const&
host()
const {
return host_; }
75 QString
const&
cat()
const {
return cat_; }
80 QString
const&
app()
const {
return app_; }
85 timeval
time()
const {
return time_; }
90 size_t seq()
const {
return seq_; }
108 void setMessage(std::string prefix,
int iteration, std::string msg);
113 void setHostAddr(std::string hostaddr) { hostaddr_ = QString(hostaddr.c_str()).toHtmlEscaped(); }
118 void setFileName(std::string file) { file_ = QString(file.c_str()).toHtmlEscaped(); }
123 void setLineNumber(std::string line) { line_ = QString(line.c_str()).toHtmlEscaped(); }
128 void setModule(std::string module) { module_ = QString(module.c_str()).toHtmlEscaped(); }
133 void setEventID(std::string eventID) { eventID_ = QString(eventID.c_str()).toHtmlEscaped(); }
150 static size_t sequence;
153 QString application_;
167 typedef std::list<qt_mf_msg> msgs_t;
201 msgs_t::iterator
get()
const {
return iter_; };
204 msgs_t::iterator iter_;
211 typedef std::list<msg_iter_t> msg_iters_t;
215 typedef std::map<QString, msg_iters_t> msg_iters_map_t;
QString const & app() const
Get the application of the message
void updateText()
Parse fields and create HTML string representing message
void setEventID(std::string eventID)
Set the Event ID of the message
timeval time() const
Get the message timestamp
size_t seq() const
Get the sequence number of the message
void setFileName(std::string file)
Set the file name field
Qt wrapper around MessageFacility message
sev_code_t sev() const
Get the severity of the message
void setSeverityLevel(sev_code_t sev)
Set the severity code of the message (Viewer levels)
msg_iter_t(msgs_t::iterator it)
Construct a msg_iter_t
QString const & host() const
Get the host from which the message came
void setMessage(std::string prefix, int iteration, std::string msg)
Set the message
bool operator<(msg_iter_t const &other) const
Comparison operator, based on message sequence number
Iterator for the msgs_t type
qt_mf_msg()
Default message constructor.
void setSeverity(mf::ELseverityLevel sev)
Set the Severity of the message (MF levels)
void setHostAddr(std::string hostaddr)
Set the hostaddr field
QString const & text(bool mode) const
Get the text of the message
void setLineNumber(std::string line)
Set the line number field
QString const & cat() const
Get the category of the message
bool operator==(msg_iter_t const &other) const
Equality operator. Equality is based on the message's sequence number
void setModule(std::string module)
Set the module name
QColor const & color() const
Get the severity-based color of the message