summaryrefslogtreecommitdiffstats
path: root/qt-models/messagehandlermodel.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-17 13:02:25 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-18 09:00:21 -0700
commitf9f4a9c232357c3967394e8f6a64f9aa36430a45 (patch)
tree5a49489115fa788385daff5d42fe936231f352b7 /qt-models/messagehandlermodel.cpp
parent47506028ca81be864b4cf2f6b87b8e81d18052bc (diff)
downloadsubsurface-f9f4a9c232357c3967394e8f6a64f9aa36430a45.tar.gz
debug output: ensure our debug output is captured on Android
I would have bet money that Android used to send stderr to the logcat log, but apparently it doesn't (anymore?). So in order to be able to have a chance to debug weird cloud storage issues on Android, let's do some wholesale replacement of fprintf(stderr,...) with our own version of the INFO macro that we long ago borrowed from libdivecomputer (and rename it to ensure we don't have a conflict there). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/messagehandlermodel.cpp')
-rw-r--r--qt-models/messagehandlermodel.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/qt-models/messagehandlermodel.cpp b/qt-models/messagehandlermodel.cpp
index 4952758d2..f0807cf80 100644
--- a/qt-models/messagehandlermodel.cpp
+++ b/qt-models/messagehandlermodel.cpp
@@ -1,13 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "messagehandlermodel.h"
-
-/* based on logging bits from libdivecomputer */
-#if !defined(Q_OS_ANDROID)
-#define INFO(fmt, ...) fprintf(stderr, "INFO: " fmt "\n", ##__VA_ARGS__)
-#else
-#include <android/log.h>
-#define INFO(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, "Subsurface", "INFO: " fmt "\n", ##__VA_ARGS__);
-#endif
+#include "core/qthelper.h"
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
extern void writeToAppLogFile(QString logText);
@@ -49,7 +42,7 @@ void MessageHandlerModel::addLog(QtMsgType type, const QString& message)
beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_data.append({message, type});
endInsertRows();
- INFO("%s", qPrintable(message));
+ SSRF_INFO("%s", qPrintable(message));
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
writeToAppLogFile(message);
#endif