File indexing completed on 2025-01-05 04:29:55
0001 /** 0002 * SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QByteArray> 0010 #include <QString> 0011 0012 #include <android/log.h> 0013 0014 const char *applicationName = "org.kde.kasts"; 0015 void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) 0016 { 0017 Q_UNUSED(context) 0018 0019 QByteArray localMsg = msg.toLocal8Bit(); 0020 // const char *file = context.file ? context.file : ""; 0021 // const char *function = context.function ? context.function : ""; 0022 switch (type) { 0023 case QtDebugMsg: 0024 __android_log_write(ANDROID_LOG_DEBUG, applicationName, localMsg.constData()); 0025 break; 0026 case QtInfoMsg: 0027 __android_log_write(ANDROID_LOG_INFO, applicationName, localMsg.constData()); 0028 break; 0029 case QtWarningMsg: 0030 __android_log_write(ANDROID_LOG_WARN, applicationName, localMsg.constData()); 0031 break; 0032 case QtCriticalMsg: 0033 __android_log_write(ANDROID_LOG_ERROR, applicationName, localMsg.constData()); 0034 break; 0035 case QtFatalMsg: 0036 default: 0037 __android_log_write(ANDROID_LOG_FATAL, applicationName, localMsg.constData()); 0038 abort(); 0039 } 0040 }