From 9d18830ee2a6b7bca3ceb8aad9c0f0753774f153 Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Fri, 19 Mar 2010 09:32:58 +0000 Subject: Better QXmppLogger::LoggingType enums and obsoleted the older ones --- source/QXmppLogger.cpp | 10 +++++----- source/QXmppLogger.h | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/QXmppLogger.cpp b/source/QXmppLogger.cpp index d67ff047..3d8a327e 100644 --- a/source/QXmppLogger.cpp +++ b/source/QXmppLogger.cpp @@ -51,7 +51,7 @@ static const char *typeName(QXmppLogger::MessageType type) } QXmppLogger::QXmppLogger(QObject *parent) - : QObject(parent), m_loggingType(QXmppLogger::NONE), + : QObject(parent), m_loggingType(QXmppLogger::NoLogging), m_logFilePath("QXmppClientLog.log") { } @@ -61,7 +61,7 @@ QXmppLogger* QXmppLogger::getLogger() if(!m_logger) { m_logger = new QXmppLogger(); - m_logger->setLoggingType(FILE); + m_logger->setLoggingType(FileLogging); } return m_logger; @@ -81,7 +81,7 @@ void QXmppLogger::log(QXmppLogger::MessageType type, const QString& str) { switch(m_loggingType) { - case QXmppLogger::FILE: + case QXmppLogger::FileLogging: { QFile file(m_logFilePath); file.open(QIODevice::Append); @@ -91,10 +91,10 @@ void QXmppLogger::log(QXmppLogger::MessageType type, const QString& str) str << "\n\n"; } break; - case QXmppLogger::STDOUT: + case QXmppLogger::StdoutLogging: std::cout << typeName(type) << " " << qPrintable(str) << std::endl; break; - case QXmppLogger::SIGNAL: + case QXmppLogger::SignalLogging: emit message(type, str); break; default: diff --git a/source/QXmppLogger.h b/source/QXmppLogger.h index 0629e1fe..1526e657 100644 --- a/source/QXmppLogger.h +++ b/source/QXmppLogger.h @@ -34,10 +34,14 @@ class QXmppLogger : public QObject public: enum LoggingType { - NONE = 0, ///< Log messages are discarded - FILE, ///< Log messages are written to a file - STDOUT, ///< Log messages are written to the standard output - SIGNAL, ///< Log messages are emitted as a signal + NONE = 0, ///< DEPRECATED Log messages are discarded + FILE, ///< DEPRECATED Log messages are written to a file + STDOUT, ///< DEPRECATED Log messages are written to the standard output + + NoLogging = 0, ///< Log messages are discarded + FileLogging, ///< Log messages are written to a file + StdoutLogging, ///< Log messages are written to the standard output + SignalLogging ///< Log messages are emitted as a signal }; enum MessageType -- cgit v1.2.3