Commit bcb8e277 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use modern login (now we can do it color disable directly)

parent 58166ce1
Pipeline #84220 passed with stage
in 10 minutes and 40 seconds
......@@ -14,7 +14,7 @@
#include <kio/netaccess.h>
#include <qtest_kde.h>
#include "logging.h"
#include "ksystemlog_debug.h"
class FindIncompatibleKioTest : public QObject
{
......@@ -72,7 +72,7 @@ void FindIncompatibleKioTest::find()
existingMethods << QLatin1String("void SlaveBase::setSubUrl(QUrl const &)");
existingMethods << QLatin1String("void SlaveBase::multiGet(const QByteArray &)");
// logDebug() << existingMethods << endl;
// qCDebug(KSYSTEMLOG) << existingMethods << endl;
QFile file(outputPath);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
......@@ -211,7 +211,7 @@ QMap<QString, bool> FindIncompatibleKioTest::findMethods(const QStringList &meth
continue;
}
// logDebug() << "Line" << convertMethod(line) << endl;
// qCDebug(KSYSTEMLOG) << "Line" << convertMethod(line) << endl;
foreach (const QString &method, methods) {
if (line == convertMethod(method)) {
......@@ -219,13 +219,13 @@ QMap<QString, bool> FindIncompatibleKioTest::findMethods(const QStringList &meth
}
/*
else {
logDebug() << method << " != " << line << endl;
qCDebug(KSYSTEMLOG) << method << " != " << line << endl;
}
*/
}
}
logDebug() << endl;
qCDebug(KSYSTEMLOG) << endl;
return foundMethods;
}
......@@ -272,7 +272,7 @@ QStringList FindIncompatibleKioTest::headerContent(const QUrl &url)
KIO::NetAccess::removeTempFile(tmpFile);
} else {
logDebug() << KIO::NetAccess::lastErrorString() << endl;
qCDebug(KSYSTEMLOG) << KIO::NetAccess::lastErrorString() << endl;
}
return kioHeaderContent;
......
......@@ -24,7 +24,7 @@
#include "ksystemlogConfig.h"
#include "logging.h"
#include "ksystemlog_debug.h"
#include "kernelAnalyzer.h"
#include "localLogFileReader.h"
......
......@@ -14,7 +14,7 @@
#include "testUtil.h"
#include "logging.h"
#include "ksystemlog_debug.h"
class KioLogFileReaderTest : public QObject
{
......@@ -32,7 +32,7 @@ private:
void KioLogFileReaderTest::initTestCase()
{
logDebug() << "Hello";
qCDebug(KSYSTEMLOG) << "Hello";
}
void KioLogFileReaderTest::testKioLogFileReader()
......@@ -44,7 +44,7 @@ void KioLogFileReaderTest::testKioLogFileReader()
logFileReader->open();
connect(logFileReader, &KioLogFileReader::lineRead, this, [=](const QString &line) {
logDebug() << "Line " << line;
qCDebug(KSYSTEMLOG) << "Line " << line;
static QFile file(fixturePath);
static bool open = false;
if (!open) {
......
......@@ -17,7 +17,7 @@
#include "logViewModel.h"
#include "logViewWidget.h"
#include "logging.h"
#include "ksystemlog_debug.h"
class LogModeFactoryTest : public QObject
{
......
......@@ -24,7 +24,7 @@
#include "ksystemlogConfig.h"
#include "logging.h"
#include "ksystemlog_debug.h"
class SystemAnalyzerTest : public QObject
{
......@@ -349,7 +349,7 @@ void SystemAnalyzerTest::testMaxLines()
void SystemAnalyzerTest::compareWithMinTime(const QList<LogLine *> &logLines, const QDateTime &minTime)
{
logDebug() << "Min time : " << minTime.toString();
qCDebug(KSYSTEMLOG) << "Min time : " << minTime.toString();
for (LogLine *logLine : logLines) {
if (logLine->time() < minTime) {
......
......@@ -14,7 +14,7 @@
#include "kernelFactory.h"
#include "systemFactory.h"
#include "logging.h"
#include "ksystemlog_debug.h"
#include "logViewModel.h"
#include "logViewWidget.h"
......@@ -38,7 +38,7 @@ TestUtil::~TestUtil()
void TestUtil::registerLogModeFactories() const
{
logDebug() << "Registering existing log mode factories";
qCDebug(KSYSTEMLOG) << "Registering existing log mode factories";
Globals::instance().registerLogModeFactory(new SystemLogModeFactory());
Globals::instance().registerLogModeFactory(new KernelLogModeFactory());
}
......@@ -72,7 +72,7 @@ QVector<LogFile> TestUtil::createLogFiles(const QString &resourceFileName) const
{
QTemporaryFile *tempFile = QTemporaryFile::createNativeFile(resourceFileName);
tempFile->setAutoRemove(false);
logDebug() << "Using log file name " << tempFile;
qCDebug(KSYSTEMLOG) << "Using log file name " << tempFile;
tempFile->setPermissions(QFile::WriteUser | QFile::ReadUser | QFile::ReadOwner | QFile::WriteOwner);
LogLevel *informationLogLevel = Globals::instance().informationLogLevel();
......@@ -104,7 +104,7 @@ void TestUtil::addLogLines(const QString &fileName, const QStringList &addedLine
QFile data(fileName);
if (data.open(QFile::Append | QIODevice::Text)) {
logDebug() << "Opening " << fileName << " for writing " << addedLines.count() << " line(s).";
qCDebug(KSYSTEMLOG) << "Opening " << fileName << " for writing " << addedLines.count() << " line(s).";
QTextStream out(&data);
for (const QString &line : addedLines) {
......
......@@ -21,7 +21,7 @@
#include "ksystemlogConfig.h"
#include "defaults.h"
#include "logging.h"
#include "ksystemlog_debug.h"
ConfigurationDialog::ConfigurationDialog(QWidget *parent)
: KConfigDialog(parent, i18n("Settings"), KSystemLogConfig::self())
......@@ -37,7 +37,7 @@ ConfigurationDialog::~ConfigurationDialog()
void ConfigurationDialog::setupLogModeConfigurations()
{
logDebug() << "Setup Log Mode Configurations...";
qCDebug(KSYSTEMLOG) << "Setup Log Mode Configurations...";
const auto logModes = Globals::instance().logModes();
for (LogMode *logMode : logModes) {
......@@ -55,7 +55,7 @@ void ConfigurationDialog::setupLogModeConfigurations()
}
for (LogModeConfigurationWidget *logModeConfigurationWidget : std::as_const(mLogModeConfigurations)) {
logDebug() << "Adding " << logModeConfigurationWidget->itemName() << " configuration...";
qCDebug(KSYSTEMLOG) << "Adding " << logModeConfigurationWidget->itemName() << " configuration...";
addPage(logModeConfigurationWidget,
logModeConfigurationWidget->itemName(),
......@@ -69,7 +69,7 @@ void ConfigurationDialog::setupLogModeConfigurations()
void ConfigurationDialog::showConfiguration()
{
logDebug() << "Showing Configuration dialog...";
qCDebug(KSYSTEMLOG) << "Showing Configuration dialog...";
show();
}
......@@ -85,7 +85,7 @@ void ConfigurationDialog::setupGeneralConfiguration()
void ConfigurationDialog::updateSettings()
{
logDebug() << "Saving configuration...";
qCDebug(KSYSTEMLOG) << "Saving configuration...";
mChanged = false;
......@@ -99,18 +99,18 @@ void ConfigurationDialog::updateSettings()
Q_EMIT configurationSaved();
logDebug() << "Configuration saved";
qCDebug(KSYSTEMLOG) << "Configuration saved";
}
bool ConfigurationDialog::hasChanged()
{
logDebug() << "Current change status : " << mChanged;
qCDebug(KSYSTEMLOG) << "Current change status : " << mChanged;
return mChanged;
}
void ConfigurationDialog::updateConfiguration()
{
logDebug() << "Updating configuration...";
qCDebug(KSYSTEMLOG) << "Updating configuration...";
bool valid = mGeneralConfiguration->isValid();
if (valid) {
......@@ -134,14 +134,14 @@ void ConfigurationDialog::updateConfiguration()
void ConfigurationDialog::updateButtons()
{
logDebug() << "Updating configuration buttons...";
qCDebug(KSYSTEMLOG) << "Updating configuration buttons...";
mChanged = true;
}
void ConfigurationDialog::updateWidgets()
{
logDebug() << "Reading configuration...";
qCDebug(KSYSTEMLOG) << "Reading configuration...";
mGeneralConfiguration->readConfig();
for (LogModeConfigurationWidget *logModeConfigurationWidget : std::as_const(mLogModeConfigurations)) {
......@@ -153,7 +153,7 @@ void ConfigurationDialog::updateWidgets()
void ConfigurationDialog::updateWidgetsDefault()
{
logDebug() << "Loading default configuration...";
qCDebug(KSYSTEMLOG) << "Loading default configuration...";
mGeneralConfiguration->defaultConfig();
for (LogModeConfigurationWidget *logModeConfigurationWidget : std::as_const(mLogModeConfigurations)) {
......
......@@ -17,7 +17,7 @@
#include "logViewWidget.h"
#include "logViewWidgetItem.h"
#include "logging.h"
#include "ksystemlog_debug.h"
DetailDialog::DetailDialog(QWidget *parent)
: QDialog(parent)
......@@ -50,12 +50,12 @@ void DetailDialog::selectionChanged(LogViewWidget *logViewWidget)
// TODO Try to find a method that reload (an resize) correctly the content of the detail dialog
void DetailDialog::updateDetails()
{
// logDebug() << "Updating Detail Dialog...";
// qCDebug(KSYSTEMLOG) << "Updating Detail Dialog...";
// Get the current-last item selected
LogViewWidgetItem *item = mLogViewWidget->lastSelectedItem();
if (!item) {
logDebug() << "No item found.";
qCDebug(KSYSTEMLOG) << "No item found.";
return;
}
......@@ -86,24 +86,24 @@ void DetailDialog::updateDetails()
void DetailDialog::moveToItem(int direction)
{
if (direction < 0) {
logDebug() << "Go to previous item...";
qCDebug(KSYSTEMLOG) << "Go to previous item...";
} else {
logDebug() << "Go to next item...";
qCDebug(KSYSTEMLOG) << "Go to next item...";
}
// Get the current-last item selected
LogViewWidgetItem *item = mLogViewWidget->lastSelectedItem();
if (!item) {
logDebug() << "No item found.";
qCDebug(KSYSTEMLOG) << "No item found.";
return;
}
QTreeWidgetItem *destinationItem = mLogViewWidget->topLevelItem(mLogViewWidget->indexOfTopLevelItem(item) + direction);
if (!destinationItem) {
if (direction < 0) {
logDebug() << "No previous item found.";
qCDebug(KSYSTEMLOG) << "No previous item found.";
} else {
logDebug() << "No next item found.";
qCDebug(KSYSTEMLOG) << "No next item found.";
}
return;
}
......
......@@ -17,7 +17,7 @@
#include "defaults.h"
#include "globals.h"
#include "ksystemlogConfig.h"
#include "logging.h"
#include "ksystemlog_debug.h"
GeneralConfigurationWidget::GeneralConfigurationWidget()
: QWidget()
......@@ -100,7 +100,7 @@ void GeneralConfigurationWidget::readConfig()
void GeneralConfigurationWidget::saveConfig() const
{
logDebug() << "Save config from General preferences";
qCDebug(KSYSTEMLOG) << "Save config from General preferences";
KSystemLogConfig::setStartupLogMode(startupLogMode->itemData(startupLogMode->currentIndex()).toString());
......@@ -128,10 +128,10 @@ bool GeneralConfigurationWidget::isValid() const
LogMode *mode = Globals::instance().findLogMode(modeString);
if (mode) {
if (!mode->filesExist()) {
logDebug() << "Log files are missing for mode" << mode->name();
qCDebug(KSYSTEMLOG) << "Log files are missing for mode" << mode->name();
mWarningBox->setVisible(true);
} else {
logDebug() << "General configuration is valid";
qCDebug(KSYSTEMLOG) << "General configuration is valid";
mWarningBox->setVisible(false);
return true;
}
......@@ -143,6 +143,6 @@ bool GeneralConfigurationWidget::isValid() const
}
}
logDebug() << "General configuration is not valid";
qCDebug(KSYSTEMLOG) << "General configuration is not valid";
return false;
}
......@@ -7,7 +7,7 @@
#include "analyzer.h"
#include "ksystemlogConfig.h"
#include "logging.h"
#include "ksystemlog_debug.h"
#include "logViewModel.h"
......@@ -39,10 +39,10 @@ void Analyzer::setParsingPaused(bool paused)
bool watching;
// If we resume the parsing, then parse files to know if new lines have been appended.
if (mParsingPaused) {
logDebug() << "Pausing reading";
qCDebug(KSYSTEMLOG) << "Pausing reading";
watching = false;
} else {
logDebug() << "Relaunch reading";
qCDebug(KSYSTEMLOG) << "Relaunch reading";
watching = true;
}
......
......@@ -10,7 +10,7 @@
#include <QElapsedTimer>
#include "ksystemlogConfig.h"
#include "logging.h"
#include "ksystemlog_debug.h"
#include "logViewModel.h"
......@@ -71,19 +71,19 @@ void FileAnalyzer::logFileChanged(LogFileReader *logFileReader, ReadingMode read
{
const QString filePath = logFileReader->logFile().url().toLocalFile();
if (readingMode == Analyzer::FullRead) {
logDebug() << "File " << filePath << " has been modified on full read.";
qCDebug(KSYSTEMLOG) << "File " << filePath << " has been modified on full read.";
} else {
logDebug() << "File " << filePath << " has been modified on partial read";
qCDebug(KSYSTEMLOG) << "File " << filePath << " has been modified on partial read";
}
if (mParsingPaused) {
logDebug() << "Pause enabled. Nothing read.";
qCDebug(KSYSTEMLOG) << "Pause enabled. Nothing read.";
return;
}
logDebug() << "Locking file modifications of " << filePath;
qCDebug(KSYSTEMLOG) << "Locking file modifications of " << filePath;
mInsertionLocking.lock();
logDebug() << "Unlocking file modifications of " << filePath;
qCDebug(KSYSTEMLOG) << "Unlocking file modifications of " << filePath;
QElapsedTimer benchmark;
benchmark.start();
......@@ -95,7 +95,7 @@ void FileAnalyzer::logFileChanged(LogFileReader *logFileReader, ReadingMode read
if (readingMode == Analyzer::UpdatingRead) {
insertedLogLineCount = insertLines(content, logFileReader->logFile(), Analyzer::UpdatingRead);
} else {
logDebug() << "Reading file " << filePath;
qCDebug(KSYSTEMLOG) << "Reading file " << filePath;
Q_EMIT statusBarChanged(i18n("Opening '%1'...", filePath));
......@@ -118,18 +118,18 @@ void FileAnalyzer::logFileChanged(LogFileReader *logFileReader, ReadingMode read
// Inform MainWindow status bar
Q_EMIT statusBarChanged(i18n("Log file '%1' has changed.", filePath));
logDebug() << "Updating log files in " << benchmark.elapsed() << " ms";
qCDebug(KSYSTEMLOG) << "Updating log files in " << benchmark.elapsed() << " ms";
mInsertionLocking.unlock();
}
int FileAnalyzer::insertLines(const QStringList &bufferedLines, const LogFile &logFile, ReadingMode readingMode)
{
logDebug() << "Inserting lines...";
qCDebug(KSYSTEMLOG) << "Inserting lines...";
// If there is no line
if (bufferedLines.isEmpty()) {
logWarning() << "File is empty : " << logFile.url().toLocalFile();
qCWarning(KSYSTEMLOG) << "File is empty : " << logFile.url().toLocalFile();
}
int stop = 0;
......@@ -142,7 +142,7 @@ int FileAnalyzer::insertLines(const QStringList &bufferedLines, const LogFile &l
*
* TODO Read revertly the file and ignore last lines if we are in Descending mode
*/
logDebug() << "Log file Sort mode is " << logFileSortMode();
qCDebug(KSYSTEMLOG) << "Log file Sort mode is " << logFileSortMode();
if (logFileSortMode() == Analyzer::AscendingSortedLogFile) {
// Calculate how many lines we will ignore
if (bufferedLines.size() > KSystemLogConfig::maxLines()) {
......@@ -172,7 +172,7 @@ int FileAnalyzer::insertLines(const QStringList &bufferedLines, const LogFile &l
++currentPosition;
}
logDebug() << "Total read lines :" << (bufferedLines.size() - stop) << "(" << logFile.url().toLocalFile() << ")";
qCDebug(KSYSTEMLOG) << "Total read lines :" << (bufferedLines.size() - stop) << "(" << logFile.url().toLocalFile() << ")";
return insertedLogLineCount;
}
......
......@@ -19,7 +19,7 @@
#include "logModeConfiguration.h"
#include "logModeConfigurationWidget.h"
#include "logging.h"
#include "ksystemlog_debug.h"
Globals &Globals::instance()
{
......
......@@ -14,7 +14,7 @@
#include <KDirWatch>
#include "logging.h"
#include "ksystemlog_debug.h"
#define READ_SIZE 10
......@@ -29,7 +29,7 @@ KioLogFileReader::KioLogFileReader(const LogFile &logFile)
connect(& (fileWatch), SIGNAL(timeout()), this, SLOT(watchFile()));
*/
logDebug() << "Starting " << logFile.url().toLocalFile();
qCDebug(KSYSTEMLOG) << "Starting " << logFile.url().toLocalFile();
}
KioLogFileReader::~KioLogFileReader()
......@@ -38,7 +38,7 @@ KioLogFileReader::~KioLogFileReader()
void KioLogFileReader::open()
{
logDebug() << "Opening...";
qCDebug(KSYSTEMLOG) << "Opening...";
mFileJob = KIO::open(mLogFile.url(), QIODevice::ReadOnly | QIODevice::Text);
connect(mFileJob, &KIO::FileJob::open, this, &KioLogFileReader::openDone);
......@@ -46,7 +46,7 @@ void KioLogFileReader::open()
connect(mFileJob, &KIO::FileJob::data, this, &KioLogFileReader::dataReceived);
connect(mFileJob, &KIO::FileJob::mimeTypeFound, this, &KioLogFileReader::mimetypeReceived);
logDebug() << "File opened.";
qCDebug(KSYSTEMLOG) << "File opened.";
}
void KioLogFileReader::close()
......@@ -56,20 +56,20 @@ void KioLogFileReader::close()
void KioLogFileReader::openDone(KIO::Job * /*job*/)
{
logDebug() << "Opening done...";
qCDebug(KSYSTEMLOG) << "Opening done...";
mFileJob->read(READ_SIZE);
}
void KioLogFileReader::closeDone(KIO::Job * /*job*/)
{
logDebug() << "Closing done...";
qCDebug(KSYSTEMLOG) << "Closing done...";
}
void KioLogFileReader::dataReceived(KIO::Job *job, const QByteArray &data)
{
if (job != mFileJob) {
logDebug() << "Not the good job";
qCDebug(KSYSTEMLOG) << "Not the good job";
return;
}
......@@ -77,21 +77,21 @@ void KioLogFileReader::dataReceived(KIO::Job *job, const QByteArray &data)
return;
}
// logDebug() << "Receiving data... (" << totalRead << ")";
// qCDebug(KSYSTEMLOG) << "Receiving data... (" << totalRead << ")";
mBuffer.append(QLatin1String(data));
mTotalRead += data.size();
emitCompleteLines();
logDebug() << "Total read : " << mTotalRead << " of " << mFileJob->size();
qCDebug(KSYSTEMLOG) << "Total read : " << mTotalRead << " of " << mFileJob->size();
if (mTotalRead < mFileJob->size()) {
mFileJob->read(READ_SIZE);
} else {
logDebug() << "Entire file read, beginning file watching...";
qCDebug(KSYSTEMLOG) << "Entire file read, beginning file watching...";
mFileWatch->startScan();
}
// logDebug() << "Data received : " << buffer;
// qCDebug(KSYSTEMLOG) << "Data received : " << buffer;
// totalRead++;
}
......@@ -121,10 +121,10 @@ void KioLogFileReader::emitCompleteLines()
void KioLogFileReader::mimetypeReceived(KIO::Job * /*job*/, const QString &type)
{
logDebug() << "Mimetype received " << type;
qCDebug(KSYSTEMLOG) << "Mimetype received " << type;
}
void KioLogFileReader::watchFile(const QString &path)
{
logDebug() << "Watch file : size : " << path;
qCDebug(KSYSTEMLOG) << "Watch file : size : " << path;
}
......@@ -13,9 +13,9 @@
#include <QGridLayout>
#include <QLabel>
#include "ksystemlog_debug.h"
#include "logLevel.h"
#include "logViewWidgetItem.h"
#include "logging.h"
#include "globals.h"
......@@ -53,7 +53,7 @@ LevelPrintPage::LevelPrintPage(QWidget *parent)
mBtnGroup->addButton(button, level->id());
mBtnGroupLayout->addWidget(button, row, col);
logDebug() << "name: " << level->name() << " id: " << level->id();
qCDebug(KSYSTEMLOG) << "name: " << level->name() << " id: " << level->id();
row++;
if (row >= 4) {
......
......@@ -18,7 +18,7 @@
#include "logFileReaderPrivate.h"
#include "logging.h"
#include "ksystemlog_debug.h"
class LocalLogFileReaderPrivate : public LogFileReaderPrivate
{
......@@ -65,7 +65,7 @@ void LocalLogFileReader::init()
// Init current file position
d->mPreviousFilePosition = 0;
logDebug() << "Reading local file " << d->logFile.url().toLocalFile();
qCDebug(KSYSTEMLOG) << "Reading local file " << d->logFile.url().toLocalFile();
}
void LocalLogFileReader::watchFile(bool enable)
......@@ -74,7 +74,7 @@ void LocalLogFileReader::watchFile(bool enable)
const QString filePath = d->logFile.url().toLocalFile();
if (enable) {
logDebug() << "Monitoring file : " << filePath;
qCDebug(KSYSTEMLOG) << "Monitoring file : " << filePath;
if (!d->mWatch->contains(filePath)) {
d->mWatch->addFile(filePath);
......@@ -104,7 +104,7 @@ QIODevice *LocalLogFileReader::open()
QMimeDatabase db;
const QString mimeType = db.mimeTypeForFile(filePath, QMimeDatabase::MatchContent).name();
logDebug() << filePath << " : " << mimeType;
qCDebug(KSYSTEMLOG) << filePath << " : " << mimeType;
QScopedPointer<QIODevice> inputDevice;
// Try to see if this file exists
......@@ -119,13 +119,13 @@ QIODevice *LocalLogFileReader::open()
// Plain text file : we use a QFile object
if (mimeType == QLatin1String("text/plain") || mimeType == QLatin1String("application/octet-stream")) {
logDebug() << "Using QFile input device";
qCDebug(KSYSTEMLOG) << "Using QFile input device";
inputDevice.reset(new QFile(filePath));
}
// Compressed file : we use the KFilterDev helper
else {
logDebug() << "Using KFilterDev input device";
qCDebug(KSYSTEMLOG) << "Using KFilterDev input device";
// inputDevice = KFilterDev::deviceForFile(filePath, mimeType);
......@@ -157,7 +157,7 @@ void LocalLogFileReader::close(QIODevice *inputDevice)
QStringList LocalLogFileReader::readContent(QIODevice *inputDevice)
{
logDebug() << "Retrieving raw buffer...";
qCDebug(KSYSTEMLOG) << "Retrieving raw buffer...";
Q_D(LocalLogFileReader);
......@@ -168,11 +168,11 @@ QStringList LocalLogFileReader::readContent(QIODevice *inputDevice)
rawBuffer.append(inputStream.readLine());
}