summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcore_mac_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qcore_mac_p.h')
-rw-r--r--src/corelib/kernel/qcore_mac_p.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 13143a08bb..9c6cef68b2 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -159,6 +159,37 @@ QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool);
Q_CORE_EXPORT void qt_apple_check_os_version();
+// --------------------------------------------------------------------------
+
+#if !defined(QT_BOOTSTRAPPED) && (QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) || !defined(Q_OS_MACOS))
+#define QT_USE_APPLE_UNIFIED_LOGGING
+
+QT_END_NAMESPACE
+#include <os/log.h>
+
+// The compiler isn't smart enough to realize that we're calling these functions
+// guarded by __builtin_available, so we need to also tag each function with the
+// runtime requirements.
+#include <os/availability.h>
+#define OS_LOG_AVAILABILITY API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0))
+QT_BEGIN_NAMESPACE
+
+class Q_CORE_EXPORT AppleUnifiedLogger
+{
+public:
+ static bool messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message,
+ const QString &subsystem = QString()) OS_LOG_AVAILABILITY;
+private:
+ static os_log_type_t logTypeForMessageType(QtMsgType msgType) OS_LOG_AVAILABILITY;
+ static os_log_t cachedLog(const QString &subsystem, const QString &category) OS_LOG_AVAILABILITY;
+};
+
+#undef OS_LOG_AVAILABILITY
+
+#endif
+
+// --------------------------------------------------------------------------
+
QT_END_NAMESPACE
#endif // QCORE_MAC_P_H