1 #include "mfextensions/Receivers/LogReader_receiver.hh"
3 #include "mfextensions/Receivers/ReceiverMacros.hh"
9 filename_(pset.get<std::string>(
"filename")),
12 "\\%MSG-([wide])\\s([^:]*):\\s\\s([^\\s]*)\\s*(\\d\\d-[^-]*-\\d{4}\\s\\d+:\\d+:\\d+)\\s.[DS]T\\s\\s(\\w+)")
16 std::cout <<
"LogReader_receiver Constructor" << std::endl;
22 while (!stopRequested_) {
23 log_.open(filename_.c_str(), std::fstream::in);
26 if (log_.is_open() && log_.good()) {
27 bool msgFound =
false;
36 if (line.find(
"%MSG") != std::string::npos) {
43 std::cout <<
"Message found, emitting!" << std::endl;
44 emit NewMessage(read_next());
57 std::cout <<
"LogReader_receiver shutting down!" << std::endl;
69 std::string category, application, eventID;
71 sev_code_t sev = SERROR;
73 if (boost::regex_search(line, what_, metadata_1)) {
75 std::cout <<
">> " << std::string(what_[1].first, what_[1].second) <<
"\n";
76 std::cout <<
">> " << std::string(what_[2].first, what_[2].second) <<
"\n";
77 std::cout <<
">> " << std::string(what_[3].first, what_[3].second) <<
"\n";
78 std::cout <<
">> " << std::string(what_[4].first, what_[4].second) <<
"\n";
79 std::cout <<
">> " << std::string(what_[5].first, what_[5].second) <<
"\n";
82 std::string value = std::string(what_[1].first, what_[1].second);
104 value = std::string(what_[4].first, what_[4].second);
105 strptime(value.c_str(),
"%d-%b-%Y %H:%M:%S", &tm);
112 category = std::string(what_[2].first, what_[2].second);
113 application = std::string(what_[3].first, what_[3].second);
115 eventID = std::string(what_[5].first, what_[5].second);
122 qt_mf_msg msg(
"", category, application, 0, tv);
126 while (!log_.eof() && line.find(
"%MSG") == std::string::npos) {
137 #include "moc_LogReader_receiver.cpp"
void updateText()
Parse fields and create HTML string representing message
void setEventID(std::string eventID)
Set the Event ID of the message
LogReader(fhicl::ParameterSet pset)
LogReader Constructor
qt_mf_msg read_next()
Read the next message from the input stream
virtual ~LogReader()
LogReader Destructor
Qt wrapper around MessageFacility message
void run()
Receiver loop method. Reads messages from file and emits newMessage signal
void setSeverityLevel(sev_code_t sev)
Set the severity code of the message (Viewer levels)
void setMessage(std::string prefix, int iteration, std::string msg)
Set the message
MessageFacility Log Reader Read messagefacility log archive and reemit as messagefacility messages ...
A MVReceiver class listens for messages and raises a signal when one arrives