summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-13 16:53:51 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-13 17:07:43 -0700
commit0df43252bef7d6aa8733de0c4c3ab8698636dc8e (patch)
tree3dad89e47a70cbe19e6b94aef8c25b9c73b52f09 /qt-models
parent27b921fb1d0c9d5350a9834837465178aa8e819d (diff)
downloadsubsurface-0df43252bef7d6aa8733de0c4c3ab8698636dc8e.tar.gz
iOS: log messages
So far we only wrote messages to subsurface.log on Android (since we couldn't figure out how to make that file user accessible on iOS). Now that that's fixed, we also need to actually write to the file in the first place. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/messagehandlermodel.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/qt-models/messagehandlermodel.cpp b/qt-models/messagehandlermodel.cpp
index e14aaf89c..be077a1a3 100644
--- a/qt-models/messagehandlermodel.cpp
+++ b/qt-models/messagehandlermodel.cpp
@@ -5,11 +5,14 @@
#if !defined(Q_OS_ANDROID)
#define INFO(fmt, ...) fprintf(stderr, "INFO: " fmt "\n", ##__VA_ARGS__)
#else
-extern void writeToAppLogFile(QString logText);
#include <android/log.h>
#define INFO(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, __FILE__, "INFO: " fmt "\n", ##__VA_ARGS__);
#endif
+#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
+extern void writeToAppLogFile(QString logText);
+#endif
+
void logMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
Q_UNUSED(context)
@@ -43,7 +46,7 @@ void MessageHandlerModel::addLog(QtMsgType type, const QString& message)
m_data.append({message, type});
endInsertRows();
INFO("%s", qPrintable(message));
-#if defined (Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
writeToAppLogFile(message);
#endif
}