summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-12-08 18:46:44 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-02-12 23:35:13 +0000
commit211791d01cf89bb75691f965d3a4ebc42c5ed8ee (patch)
tree6a85f8b7066144efb9dca3e73942265191aeb9d1 /src/corelib/global
parentb2b32682a95401f863e2b71a553c1375136e2595 (diff)
Add support for Apple Unified Logging
If the OS supports it, we will now log to the Apple unified logging system in addition to the normal stderr output. These logs can be inspected via the Console application, or the 'log' command line tool. See https://developer.apple.com/documentation/os/logging [ChangeLog][QtCore] Apple Unified Logging is now supported on Apple platforms. Task-number: QTBUG-38156 Done-with: Jake Petroules <jake.petroules@qt.io> Change-Id: I2ab92bd192d5b98aaf77e41501ea7b1ca6ef2425 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qlogging.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index ba0c105372..39a5bbf645 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -71,6 +71,10 @@
#include <android/log.h>
#endif
+#ifdef Q_OS_DARWIN
+#include <QtCore/private/qcore_mac_p.h>
+#endif
+
#if QT_CONFIG(journald)
# define SD_JOURNAL_SUPPRESS_LOCATION
# include <systemd/sd-journal.h>
@@ -1676,6 +1680,9 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
handledStderr |= syslog_default_message_handler(type, context, message);
# elif defined(Q_OS_ANDROID)
handledStderr |= android_default_message_handler(type, context, message);
+# elif defined(QT_USE_APPLE_UNIFIED_LOGGING)
+ if (__builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *))
+ handledStderr |= AppleUnifiedLogger::messageHandler(type, context, message);
# endif
#endif