aboutsummaryrefslogtreecommitdiff
path: root/src/QXmppLogger.h
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-11 07:31:23 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-11 07:31:23 +0000
commit40c39853816cfab113d79682c34bc76a2c79c357 (patch)
treee4d6a184cf565cb87477339ce738299ff9787bc3 /src/QXmppLogger.h
parent551c284e35280b7b91a939fe7352e496ffea402a (diff)
downloadqxmpp-40c39853816cfab113d79682c34bc76a2c79c357.tar.gz
rename "source" directory to "src"
Diffstat (limited to 'src/QXmppLogger.h')
-rw-r--r--src/QXmppLogger.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/QXmppLogger.h b/src/QXmppLogger.h
new file mode 100644
index 00000000..f0fee6df
--- /dev/null
+++ b/src/QXmppLogger.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2008-2010 The QXmpp developers
+ *
+ * Author:
+ * Manjeet Dahiya
+ *
+ * Source:
+ * http://code.google.com/p/qxmpp
+ *
+ * This file is a part of QXmpp library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+
+#ifndef QXMPPLOGGER_H
+#define QXMPPLOGGER_H
+
+#include <QObject>
+
+/// \brief The QXmppLogger class represents a sink for logging messages.
+///
+/// \ingroup Core
+
+class QXmppLogger : public QObject
+{
+ Q_OBJECT
+
+public:
+ /// This enum describes how log message are handled.
+ enum LoggingType
+ {
+ NoLogging = 0, ///< Log messages are discarded
+ FileLogging = 1, ///< Log messages are written to a file
+ StdoutLogging = 2, ///< Log messages are written to the standard output
+ SignalLogging = 4, ///< Log messages are emitted as a signal
+
+ // Deprecated
+ /// \cond
+ NONE = 0, ///< DEPRECATED Log messages are discarded
+ FILE = 1, ///< DEPRECATED Log messages are written to a file
+ STDOUT = 2 ///< DEPRECATED Log messages are written to the standard output
+ /// \endcond
+ };
+
+ /// This enum describes a type of log message.
+ enum MessageType
+ {
+ DebugMessage = 0, ///< Debugging message
+ InformationMessage, ///< Informational message
+ WarningMessage, ///< Warning message
+ ReceivedMessage, ///< Message received from server
+ SentMessage, ///< Message sent to server
+ };
+
+ QXmppLogger(QObject *parent = 0);
+ static QXmppLogger* getLogger();
+
+ QXmppLogger::LoggingType loggingType();
+ void setLoggingType(QXmppLogger::LoggingType type);
+
+ QString logFilePath();
+ void setLogFilePath(const QString &path);
+
+public slots:
+ void log(QXmppLogger::MessageType type, const QString& text);
+
+signals:
+ /// This signal is emitted whenever a log message is received.
+ void message(QXmppLogger::MessageType type, const QString &text);
+
+private:
+ static QXmppLogger* m_logger;
+ QXmppLogger::LoggingType m_loggingType;
+ QString m_logFilePath;
+};
+
+#endif // QXMPPLOGGER_H