1 #include "mfextensions/Receivers/LogReader_receiver.hh"
2 #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;
26 while (!stopRequested_)
28 log_.open(filename_.c_str(), std::fstream::in);
31 if (log_.is_open() && log_.good())
33 bool msgFound =
false;
44 if (line.find(
"%MSG") != std::string::npos)
53 std::cout <<
"Message found, emitting!" << std::endl;
54 emit NewMessage(read_next());
67 std::cout <<
"LogReader_receiver shutting down!" << std::endl;
81 std::string category, application, eventID;
83 sev_code_t sev = SERROR;
85 if (boost::regex_search(line, what_, metadata_1))
88 std::cout <<
">> " << std::string(what_[1].first, what_[1].second) <<
"\n";
89 std::cout <<
">> " << std::string(what_[2].first, what_[2].second) <<
"\n";
90 std::cout <<
">> " << std::string(what_[3].first, what_[3].second) <<
"\n";
91 std::cout <<
">> " << std::string(what_[4].first, what_[4].second) <<
"\n";
92 std::cout <<
">> " << std::string(what_[5].first, what_[5].second) <<
"\n";
95 std::string value = std::string(what_[1].first, what_[1].second);
99 case 'e': sev = SERROR;
101 case 'w':sev = SWARNING;
103 case 'i': sev = SINFO;
105 case 'd': sev = SDEBUG;
113 value = std::string(what_[4].first, what_[4].second);
114 strptime(value.c_str(),
"%d-%b-%Y %H:%M:%S", &tm);
121 category = std::string(what_[2].first, what_[2].second);
122 application = std::string(what_[3].first, what_[3].second);
124 eventID = std::string(what_[5].first, what_[5].second);
131 qt_mf_msg msg(
"", category, application, 0, tv);
136 while (!log_.eof() && line.find(
"%MSG") == std::string::npos)
148 #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