From 648084fed7fbe40ea573db9e5c9d046dbdad4d1d Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Wed, 1 Sep 2021 22:11:39 +0200 Subject: [PATCH] LOG: Update the objects that use the LOG API --- src/UI/AboutWindow.cc | 2 +- src/UI/MainWindow.cc | 11 +++++++---- src/VivyApplication.cc | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/UI/AboutWindow.cc b/src/UI/AboutWindow.cc index 432c7fbf..5995a016 100644 --- a/src/UI/AboutWindow.cc +++ b/src/UI/AboutWindow.cc @@ -55,7 +55,7 @@ AboutWindow::LicenceLabel::LicenceLabel(QWidget *parent, const QString &url, const Qt::TextFormat format) : QTextEdit(parent) { - VIVY_LOG_CTOR() << "Creating label for licence '" << url << '\''; + VIVY_LOG_CTOR() << "Creating label for licence " << VIVY_LOG_QUOTED(url); QFile content(url); if (!content.open(QIODevice::ReadOnly | QIODevice::Text)) throw std::runtime_error("Failed to open file that should be accessible"); diff --git a/src/UI/MainWindow.cc b/src/UI/MainWindow.cc index f0deb261..d6384702 100644 --- a/src/UI/MainWindow.cc +++ b/src/UI/MainWindow.cc @@ -300,7 +300,8 @@ MainWindow::closeDocument(int index) noexcept &MainWindow::documentViewActionsChanged); if (documentToClose) { - logDebug() << "Delete document view " << documentToClose->getDocumentTabName(); + logDebug() + << "Delete document view " << VIVY_LOG_QUOTED(documentToClose->getDocumentTabName()); documentToClose->closeDocument(); delete documentToClose; } @@ -331,7 +332,7 @@ MainWindow::openDocument() noexcept Utils::DocumentType fileType; if (!Utils::detectDocumentType(fileInfo, &fileType)) { - logWarning() << "Failed to detect file type for " << filename; + logWarning() << "Failed to detect file type for " << VIVY_LOG_QUOTED(filename); return; } @@ -353,7 +354,8 @@ MainWindow::openDocument() noexcept addTab(newView); } } catch (const std::runtime_error &e) { - logError() << "Failed to load document " << filename << " with error: " << e.what(); + logError() << "Failed to load document " << VIVY_LOG_QUOTED(filename) + << " with error: " << e.what(); } } @@ -515,7 +517,8 @@ MainWindow::executeDialog(MainWindow *const self, QFileDialog *const dialog) noe const QStringList resList = dialog->selectedFiles(); if (resList.size() != 1) { - self->logError() << "You must select only one file"; + self->logError() + << "You must select only one file, here got " << resList.size() << " files"; return QStringLiteral(""); } diff --git a/src/VivyApplication.cc b/src/VivyApplication.cc index b6df260b..959fb498 100644 --- a/src/VivyApplication.cc +++ b/src/VivyApplication.cc @@ -6,7 +6,7 @@ using namespace Vivy; VivyApplication::VivyApplication(int &argc, char **argv) : QApplication(argc, argv) { - VIVY_LOG_CTOR(VivyApplication) << "Construction is OK"; + VIVY_LOG_CTOR() << "Construction is OK"; } void @@ -27,7 +27,7 @@ VivyApplication::setTheme(Theme theme) noexcept stylesheet.open(QFile::ReadOnly | QFile::Text); QTextStream stylesheetStream(&stylesheet); setStyleSheet(stylesheetStream.readAll()); - logInfo() << "Theme set using " << sheet; + logInfo() << "Theme set using " << VIVY_LOG_QUOTED(sheet); } flushLogSink(); -- GitLab