[Pkg-owncloud-commits] [owncloud-client] 161/333: Add the file and line number of the debug in the debug view

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:48 UTC 2014


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 6377dca4b073c15baa10ad881ade674965a9a3ba
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Mon Mar 17 12:15:45 2014 +0100

    Add the file and line number of the debug in the debug view
---
 src/mirall/logger.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/mirall/logger.cpp b/src/mirall/logger.cpp
index 7b82e6b..6c85619 100644
--- a/src/mirall/logger.cpp
+++ b/src/mirall/logger.cpp
@@ -19,13 +19,24 @@
 
 namespace Mirall {
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 // logging handler.
-void mirallLogCatcher(QtMsgType type, const char *msg)
+static void mirallLogCatcher(QtMsgType type, const char *msg)
 {
   Q_UNUSED(type)
   // qDebug() exports to local8Bit, which is not always UTF-8
   Logger::instance()->mirallLog( QString::fromLocal8Bit(msg) );
 }
+#else
+static void mirallLogCatcher(QtMsgType, const QMessageLogContext &ctx, const QString &message) {
+    Q_UNUSED(ctx);
+
+    QByteArray file = ctx.file;
+    file = file.mid(file.lastIndexOf('/') + 1);
+    Logger::instance()->mirallLog( QString::fromLocal8Bit(file) + QLatin1Char(':') + QString::number(ctx.line)
+                                    + QLatin1Char(' ')  + message) ;
+}
+#endif
 
 Logger* Logger::_instance=0;
 
@@ -39,7 +50,11 @@ Logger *Logger::instance()
 {
     if( !Logger::_instance ) {
         Logger::_instance = new Logger;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
         qInstallMsgHandler( mirallLogCatcher );
+#else
+        qInstallMessageHandler(mirallLogCatcher);
+#endif
     }
     return Logger::_instance;
 }

-- 
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