File indexing completed on 2024-05-12 05:25:24
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #include "loginfo.h" 0007 #include <QDebug> 0008 0009 LogInfo::LogInfo(QObject *parent) 0010 : QObject(parent) 0011 { 0012 } 0013 0014 LogInfo::~LogInfo() = default; 0015 0016 void LogInfo::addInfoLogEntry(const QString &log) 0017 { 0018 addLogLine(log, AddInfo); 0019 } 0020 0021 void LogInfo::addErrorLogEntry(const QString &log) 0022 { 0023 addLogLine(log, AddError); 0024 } 0025 0026 void LogInfo::addTitleLogEntry(const QString &log) 0027 { 0028 addLogLine(log, AddTitle); 0029 } 0030 0031 void LogInfo::addEndLineLogEntry() 0032 { 0033 addLogLine(QString(), AddEndLine); 0034 } 0035 0036 void LogInfo::addLogLine(const QString &message, LogType type) 0037 { 0038 QString newMessage; 0039 switch (type) { 0040 case AddEndLine: 0041 newMessage = QLatin1Char('\n'); 0042 break; 0043 case AddInfo: 0044 newMessage = QStringLiteral("INFO: %1").arg(message); 0045 break; 0046 case AddError: 0047 newMessage = QStringLiteral("ERROR: %1").arg(message); 0048 break; 0049 case AddTitle: 0050 newMessage = message; 0051 break; 0052 } 0053 // Laurent: Don't use qCDebug here. 0054 qDebug() << newMessage; 0055 } 0056 0057 #include "moc_loginfo.cpp"