aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorManjeet Dahiya <manjeetdahiya@gmail.com>2010-03-09 10:26:43 +0000
committerManjeet Dahiya <manjeetdahiya@gmail.com>2010-03-09 10:26:43 +0000
commitf3f364328066386d2a10915a1e37230182005664 (patch)
tree315ffbcb01ce05ff9f2ec7ae41c287859a9b45a8 /source
parent24ebbb9d8cca17092305dec552bc1a87507d96e6 (diff)
downloadqxmpp-f3f364328066386d2a10915a1e37230182005664.tar.gz
functionality to specify logfilePath in case of QXmppLogger::FILE type of logging
Diffstat (limited to 'source')
-rw-r--r--source/QXmppLogger.cpp14
-rw-r--r--source/QXmppLogger.h4
2 files changed, 16 insertions, 2 deletions
diff --git a/source/QXmppLogger.cpp b/source/QXmppLogger.cpp
index 97e6f64a..dc34a36d 100644
--- a/source/QXmppLogger.cpp
+++ b/source/QXmppLogger.cpp
@@ -51,7 +51,8 @@ static const char *typeName(QXmppLogger::MessageType type)
}
QXmppLogger::QXmppLogger(QObject *parent)
- : QObject(parent), m_loggingType(QXmppLogger::NONE)
+ : QObject(parent), m_loggingType(QXmppLogger::NONE),
+ m_logFilePath("QXmppClientLog.log")
{
}
@@ -83,7 +84,7 @@ void QXmppLogger::log(QXmppLogger::MessageType type, const QString& str)
{
case QXmppLogger::FILE:
{
- QFile file("QXmppClientLog.log");
+ QFile file(m_logFilePath);
file.open(QIODevice::Append);
QTextStream stream(&file);
stream << QTime::currentTime().toString("hh:mm:ss.zzz") <<
@@ -110,3 +111,12 @@ QXmppLogger::LoggingType QXmppLogger::getLoggingType()
return m_loggingType;
}
+void QXmppLogger::setLogFilePath(const QString& logFilePath)
+{
+ m_logFilePath = logFilePath;
+}
+
+QString QXmppLogger::logFilePath()
+{
+ return m_logFilePath;
+}
diff --git a/source/QXmppLogger.h b/source/QXmppLogger.h
index d9907a61..cf8f9290 100644
--- a/source/QXmppLogger.h
+++ b/source/QXmppLogger.h
@@ -55,6 +55,9 @@ public:
QXmppLogger::LoggingType loggingType();
void setLoggingType(QXmppLogger::LoggingType);
+ void setLogFilePath(const QString&);
+ QString logFilePath();
+
virtual void log(QXmppLogger::MessageType type, const QString& str);
// deprecated accessors, use the form without "get" instead
@@ -66,6 +69,7 @@ signals:
private:
static QXmppLogger* m_logger;
QXmppLogger::LoggingType m_loggingType;
+ QString m_logFilePath;
};
#endif // QXMPPLOGGER_H