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

XmlLogHandler: Clean up coding style

parent 5c513623
...@@ -29,16 +29,21 @@ ...@@ -29,16 +29,21 @@
*/ */
#include "XmlLogHandler.h" #include "XmlLogHandler.h"
#include <gloox/loghandler.h>
// gloox
#include <gloox/client.h> #include <gloox/client.h>
// Qt
#include <QDebug> #include <QDebug>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
XmlLogHandler::XmlLogHandler(gloox::Client *client) : client(client) XmlLogHandler::XmlLogHandler(gloox::Client *client) : client(client)
{ {
client->logInstance().registerLogHandler(gloox::LogLevelDebug, gloox::LogAreaXmlIncoming | client->logInstance().registerLogHandler(
gloox::LogAreaXmlOutgoing, this); gloox::LogLevelDebug,
gloox::LogAreaXmlIncoming | gloox::LogAreaXmlOutgoing,
this
);
} }
XmlLogHandler::~XmlLogHandler() XmlLogHandler::~XmlLogHandler()
...@@ -46,15 +51,15 @@ XmlLogHandler::~XmlLogHandler() ...@@ -46,15 +51,15 @@ XmlLogHandler::~XmlLogHandler()
client->logInstance().removeLogHandler(this); 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) { if (area == gloox::LogAreaXmlIncoming)
qDebug() << "[XML] [Incoming] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"; qDebug() << "[client] [incoming] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";
qDebug().noquote() << makeXmlPretty(QString::fromStdString(message)); else if (area == gloox::LogAreaXmlOutgoing)
} else if (area == gloox::LogAreaXmlOutgoing) { qDebug() << "[client] [outgoing] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
qDebug() << "[XML] [Outgoing] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
qDebug().noquote() << makeXmlPretty(QString::fromStdString(message)); qDebug().noquote() << makeXmlPretty(QString::fromStdString(message));
}
} }
QString XmlLogHandler::makeXmlPretty(QString xmlIn) QString XmlLogHandler::makeXmlPretty(QString xmlIn)
......
...@@ -43,7 +43,9 @@ class XmlLogHandler : public gloox::LogHandler ...@@ -43,7 +43,9 @@ class XmlLogHandler : public gloox::LogHandler
public: public:
XmlLogHandler(gloox::Client *client); XmlLogHandler(gloox::Client *client);
~XmlLogHandler(); ~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); static QString makeXmlPretty(QString inputXml);
private: 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