From 5f52885fbfa704011e6bf0e5727177b1e4bb2128 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 20 May 2023 21:49:40 +0200 Subject: [PATCH] Ilogger - Separate behaviour for user exposed and not exposed loggers --- src/Base/ConsoleObserver.cpp | 12 ++++++++---- src/Gui/GuiConsole.cpp | 6 ++++-- src/Gui/MainWindow.cpp | 8 ++++++-- src/Gui/ReportView.cpp | 7 +++++-- src/Gui/Splashscreen.cpp | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/Base/ConsoleObserver.cpp b/src/Base/ConsoleObserver.cpp index d26509862b..27e8122c27 100644 --- a/src/Base/ConsoleObserver.cpp +++ b/src/Base/ConsoleObserver.cpp @@ -62,8 +62,10 @@ void ConsoleObserverFile::SendLog(const std::string& notifiername, const std::st IntendedRecipient recipient, ContentType content) { (void) notifiername; - (void) recipient; - (void) content; + + // Do not log translated messages, or messages intended only to the user to log file + if(recipient == IntendedRecipient::User || content == ContentType::Translated) + return; std::string prefix; switch(level){ @@ -108,8 +110,10 @@ void ConsoleObserverStd::SendLog(const std::string& notifiername, const std::str IntendedRecipient recipient, ContentType content) { (void) notifiername; - (void) recipient; - (void) content; + + // Do not log translated messages, or messages intended only to the user to std log + if(recipient == IntendedRecipient::User || content == ContentType::Translated) + return; switch(level){ case LogStyle::Warning: diff --git a/src/Gui/GuiConsole.cpp b/src/Gui/GuiConsole.cpp index ef36b35bbb..9516980443 100644 --- a/src/Gui/GuiConsole.cpp +++ b/src/Gui/GuiConsole.cpp @@ -125,8 +125,10 @@ void GUIConsole::SendLog(const std::string& notifiername, const std::string& msg Base::IntendedRecipient recipient, Base::ContentType content) { (void) notifiername; - (void) recipient; - (void) content; + + // Do not log translated messages, or messages intended only to the user to std log + if(recipient == Base::IntendedRecipient::User || content == Base::ContentType::Translated) + return; switch(level){ case Base::LogStyle::Warning: diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index e7b866323a..4ba658eac6 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -2256,8 +2256,12 @@ void StatusBarObserver::SendLog(const std::string& notifiername, const std::stri Base::IntendedRecipient recipient, Base::ContentType content) { (void) notifiername; - (void) recipient; - (void) content; + + // Do not log untranslated messages, or messages intended only to a developer to status bar + if( recipient == Base::IntendedRecipient::Developer || + content == Base::ContentType::Untranslated || + content == Base::ContentType::Untranslatable ) + return; int messageType = -1; switch(level){ diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index a9427cb48d..27947f2a5f 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -476,8 +476,11 @@ void ReportOutput::SendLog(const std::string& notifiername, const std::string& m Base::IntendedRecipient recipient, Base::ContentType content) { (void) notifiername; - (void) recipient; - (void) content; + + // Do not log translated messages, or messages intended only to the user to the Report View + if( recipient == Base::IntendedRecipient::User || + content == Base::ContentType::Translated) + return; ReportHighlighter::Paragraph style = ReportHighlighter::LogText; switch (level) { diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index 87c1c81bc2..9bd14e1fc6 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -182,7 +182,7 @@ public: Q_UNUSED(notifiername) Q_UNUSED(recipient) Q_UNUSED(content) - + #ifdef FC_DEBUG Log(msg.c_str()); Q_UNUSED(level)