Warning, file /system/drkonqi-pk-debug-installer/src/Logger.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org> 0003 0004 #pragma once 0005 0006 #include <QObject> 0007 0008 // Installs a qt message handler to capture all qDebugs inside the process 0009 // so we can display them to the user on error in hopes of the user telling us 0010 // and the log making it easier to figure out what went wrong. 0011 class Logger : public QObject 0012 { 0013 Q_OBJECT 0014 public: 0015 // Singleton instance 0016 static Logger *instance(); 0017 // Installs the qMessageHandler 0018 void install(); 0019 // Dump the captured log 0020 Q_INVOKABLE QStringList log(); 0021 0022 private: 0023 static void handler(QtMsgType type, const QMessageLogContext &context, const QString &msg); 0024 0025 QtMessageHandler previousHandler = nullptr; 0026 QStringList data; 0027 };