feat: support set file log path
authorIceyer <me@iceyer.net>
Tue, 10 Apr 2018 05:46:32 +0000 (13:46 +0800)
committerIceyer <me@iceyer.net>
Tue, 10 Apr 2018 05:46:32 +0000 (13:46 +0800)
Change-Id: Idd5347c629c17b472ca9d9ce8ae55d76dd8e5011

src/log/LogManager.cpp
src/log/LogManager.h

index 2eb54984f8610c5dbee44cbd7905deea2feefaa1..55a9e4cfc9070eba37ceeb0117f2b8b2d4099398 100644 (file)
@@ -77,6 +77,11 @@ QString DLogManager::getlogFilePath(){
     return QDir::toNativeSeparators(DLogManager::instance()->m_logPath);
 }
 
+void DLogManager::setlogFilePath(const QString &logFilePath)
+{
+    DLogManager::instance()->m_logPath = logFilePath;
+}
+
 void DLogManager::setLogFormat(const QString &format)
 {
     //m_format = "%{time}{yyyy-MM-dd, HH:mm:ss.zzz} [%{type:-7}] [%{file:-20} %{function:-35} %{line}] %{message}\n";
index 85fa6fccdd3b2636ce879dbcd1118d2268ce2dbd..c79b5829523baccce84b5088bfe25374c33d6126 100644 (file)
@@ -32,12 +32,16 @@ class DLogManager
 public:
     static void registerConsoleAppender();
     static void registerFileAppender();
+
     static QString getlogFilePath();
-    static void setLogFormat(const QString& format);
 
-Q_SIGNALS:
+    /*!
+     * \brief setlogFilePath will change log file path of registerFileAppender
+     * \param logFilePath is the full path of file appender log
+     */
+    static void setlogFilePath(const QString& logFilePath);
 
-public Q_SLOTS:
+    static void setLogFormat(const QString& format);
 
 private:
     QString m_format;