void LoggingHandler::writeTableEntry(const Poco::Message& msg, const std::string& trClass, std::ostream& out)
{
	out << "<tr class=\"" << trClass << "\">";
	out << "<td><img src =\"" << image(msg.getPriority()) << "\" width=\"20\" height=\"20\" alt=\"" << convert(msg.getPriority()) << "\" title =\"" << convert(msg.getPriority()) << "\"/></td>";
	out << "<td>" << msg.getSource() << "</td>";
	out << "<td>" << msg.getText() << "</td>";
	out << "<td>" << convert(msg.getPriority()) << "</td>";
	out << "<td>" << Poco::DateTimeFormatter::format(msg.getTime(), Poco::DateTimeFormat::SORTABLE_FORMAT) << "</td>";
	out << "<td>" << msg.getTid() << "</td>";
	out << "<td>" << msg.getThread() << "</td>";
	out << "<td>" << msg.getPid() << "</td>";
	out << "</tr>";
}
std::string messageToJSON(const Poco::Message& message)
{
	std::ostringstream json;
	
	json 
		<< "{"
		<< quote("source") << ":"
		<< jsonize(message.getSource())
		<< ","
		<< quote("text") << ":"
		<< jsonize(message.getText())
		<< ","
		<< quote("priority") << ":"
		<< static_cast<int>(message.getPriority())
		<< ","
		<< quote("timestamp") << ":"
		<< quote(Poco::DateTimeFormatter::format(message.getTime(), Poco::DateTimeFormat::ISO8601_FRAC_FORMAT))
		<< "}";
	
	return json.str();
}
Exemple #3
0
/**
 * If the source is set then only messages with a matching source
 * cause a Qt signal to be emitted. A newline is appended as the
 * Poco log stream emits the message when a newline is received but doesn't
 * actually send a newline character
 * @param msg A Poco message object containing a priority & the string message
 */
void QtSignalChannel::log(const Poco::Message &msg) {
  if (m_source.isEmpty() || this->source() == msg.getSource().c_str()) {
    emit messageReceived(API::Message(
        QString::fromStdString(msg.getText() + "\n"), msg.getPriority()));
  }
}
Exemple #4
0
void ApacheChannel::log(const Poco::Message& msg)
{
	ApacheConnector::log(msg.getSource().c_str(), 0, msg.getPriority(), 0, msg.getText().c_str());
}
Exemple #5
0
/**
 *  A boost 'slot' for the Mantid signal channel connection. This relays the message to
 * a Qt signal
 * @param msg :: The Poco message parameter
 */
void UserSubWindow::mantidLogReceiver(const Poco::Message & msg)
{
  emit logMessageReceived(QString::fromStdString(msg.getText()));
}