summaryrefslogtreecommitdiffstats
path: root/qt-models/messagehandlermodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/messagehandlermodel.cpp')
-rw-r--r--qt-models/messagehandlermodel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-models/messagehandlermodel.cpp b/qt-models/messagehandlermodel.cpp
index daedad897..85c8d6500 100644
--- a/qt-models/messagehandlermodel.cpp
+++ b/qt-models/messagehandlermodel.cpp
@@ -1,5 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
#include "messagehandlermodel.h"
+/* based on logging bits from libdivecomputer */
+#ifndef __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, __FILE__, "INFO: " fmt "\n", ##__VA_ARGS__)
+#endif
+
void logMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
MessageHandlerModel::self()->addLog(type, msg);
@@ -30,6 +39,7 @@ void MessageHandlerModel::addLog(QtMsgType type, const QString& message)
beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_data.append({message, type});
endInsertRows();
+ INFO("%s", message.toUtf8().constData());
}
QVariant MessageHandlerModel::data(const QModelIndex& idx, int role) const