From: Iceyer Date: Tue, 10 Apr 2018 05:46:32 +0000 (+0800) Subject: feat: support set file log path X-Git-Tag: archive/raspbian/5.7.12-2+rpi1^2~122^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5023950e68c467e3552f03ef1a49908b5e2102d6;p=dtkcore.git feat: support set file log path Change-Id: Idd5347c629c17b472ca9d9ce8ae55d76dd8e5011 --- diff --git a/src/log/LogManager.cpp b/src/log/LogManager.cpp index 2eb5498..55a9e4c 100644 --- a/src/log/LogManager.cpp +++ b/src/log/LogManager.cpp @@ -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"; diff --git a/src/log/LogManager.h b/src/log/LogManager.h index 85fa6fc..c79b582 100644 --- a/src/log/LogManager.h +++ b/src/log/LogManager.h @@ -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;