[Pkg-owncloud-commits] [owncloud-client] 35/164: Add a NO_MSG_HANDLER cmake option

Sandro Knauß hefee-guest at moszumanska.debian.org
Sun Mar 22 11:56:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 2ddaf5a06ac53e061ac8d9d989b2597c62c6066a
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Thu Feb 19 16:49:39 2015 +0100

    Add a NO_MSG_HANDLER cmake option
    
    This allows QDebug to output to stdout or OutputDebugString
    to ease development.
---
 CMakeLists.txt         | 5 +++++
 src/libsync/logger.cpp | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d19ba3..2ff58de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,6 +102,11 @@ if(TOKEN_AUTH_ONLY)
    add_definitions(-DTOKEN_AUTH_ONLY=1)
 endif()
 
+option(NO_MSG_HANDLER "Don't redirect QDebug outputs to the log window/file" OFF)
+if(NO_MSG_HANDLER)
+   add_definitions(-DNO_MSG_HANDLER=1)
+endif()
+
 # this option creates only libocsync and libowncloudsync
 option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
 
diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp
index eb3cd91..b8e06e3 100644
--- a/src/libsync/logger.cpp
+++ b/src/libsync/logger.cpp
@@ -53,14 +53,20 @@ Logger *Logger::instance()
 Logger::Logger( QObject* parent) : QObject(parent),
   _showTime(true), _doLogging(false), _doFileFlush(false), _logExpire(0)
 {
+#ifndef NO_MSG_HANDLER
 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
     qSetMessagePattern("%{time MM-dd hh:mm:ss:zzz} %{threadid} %{function}: %{message}");
 #endif
     qInstallMessageHandler(mirallLogCatcher);
+#else
+    Q_UNUSED(mirallLogCatcher)
+#endif
 }
 
 Logger::~Logger() {
+#ifndef NO_MSG_HANDLER
     qInstallMessageHandler(0);
+#endif
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list