Commit 7654f518 authored by LNJ's avatar LNJ Committed by Jonah Brüchert

XmlLogHandler: Clean up coding style

parent 5c513623
......@@ -29,16 +29,21 @@
*/
#include "XmlLogHandler.h"
#include <gloox/loghandler.h>
// gloox
#include <gloox/client.h>
// Qt
#include <QDebug>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
XmlLogHandler::XmlLogHandler(gloox::Client *client) : client(client)
{
client->logInstance().registerLogHandler(gloox::LogLevelDebug, gloox::LogAreaXmlIncoming |
gloox::LogAreaXmlOutgoing, this);
client->logInstance().registerLogHandler(
gloox::LogLevelDebug,
gloox::LogAreaXmlIncoming | gloox::LogAreaXmlOutgoing,
this
);
}
XmlLogHandler::~XmlLogHandler()
......@@ -46,15 +51,15 @@ XmlLogHandler::~XmlLogHandler()
client->logInstance().removeLogHandler(this);
}
void XmlLogHandler::handleLog(gloox::LogLevel level, gloox::LogArea area, const std::string &message)
void XmlLogHandler::handleLog(gloox::LogLevel level, gloox::LogArea area,
const std::string &message)
{
if (area == gloox::LogAreaXmlIncoming) {
qDebug() << "[XML] [Incoming] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";
qDebug().noquote() << makeXmlPretty(QString::fromStdString(message));
} else if (area == gloox::LogAreaXmlOutgoing) {
qDebug() << "[XML] [Outgoing] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
qDebug().noquote() << makeXmlPretty(QString::fromStdString(message));
}
if (area == gloox::LogAreaXmlIncoming)
qDebug() << "[client] [incoming] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";
else if (area == gloox::LogAreaXmlOutgoing)
qDebug() << "[client] [outgoing] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
qDebug().noquote() << makeXmlPretty(QString::fromStdString(message));
}
QString XmlLogHandler::makeXmlPretty(QString xmlIn)
......
......@@ -43,7 +43,9 @@ class XmlLogHandler : public gloox::LogHandler
public:
XmlLogHandler(gloox::Client *client);
~XmlLogHandler();
virtual void handleLog(gloox::LogLevel level, gloox::LogArea area, const std::string &message);
virtual void handleLog(gloox::LogLevel level, gloox::LogArea area,
const std::string &message);
static QString makeXmlPretty(QString inputXml);
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment