From f81ff69b1ab34aed56923f5fb060e63ef8993817 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Tue, 16 Jan 2024 20:58:50 +0100 Subject: [PATCH 1/3] Bugfix forwarding logger --- .../ConfigurableForwardingLogger.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs index fc69e41d38d..2adc797d495 100644 --- a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs +++ b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs @@ -298,17 +298,20 @@ private void SetForwardingBasedOnVerbosity(IEventSource eventSource) /// internal MessageImportance GetMinimumMessageImportance() { - return _verbosity switch + if (_forwardLowImportanceMessages) { - LoggerVerbosity.Minimal => MessageImportance.High, - LoggerVerbosity.Normal => MessageImportance.Normal, - LoggerVerbosity.Detailed => MessageImportance.Low, - LoggerVerbosity.Diagnostic => MessageImportance.Low, - - // The logger does not log messages of any importance. - LoggerVerbosity.Quiet => MessageImportance.High - 1, - _ => MessageImportance.High - 1, - }; + return MessageImportance.Low; + } + if (_forwardNormalImportanceMessages) + { + return MessageImportance.Normal; + } + if (_forwardHighImportanceMessages) + { + return MessageImportance.High; + } + // The logger does not log messages of any importance. + return MessageImportance.High - 1; } /// From ff17bb74bbad2178735cdbffa80f0ac2fee78860 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Tue, 16 Jan 2024 21:02:03 +0100 Subject: [PATCH 2/3] Remove dead code --- .../ConfigurableForwardingLogger.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs index 2adc797d495..5504f448377 100644 --- a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs +++ b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs @@ -202,8 +202,6 @@ public virtual void Initialize(IEventSource eventSource) ParseParameters(eventSource); - ResetLoggerState(); - if (!_forwardingSetFromParameters) { SetForwardingBasedOnVerbosity(eventSource); @@ -314,15 +312,6 @@ internal MessageImportance GetMinimumMessageImportance() return MessageImportance.High - 1; } - /// - /// Reset the states of per-build member variables. - /// Used when a build is finished, but the logger might be needed for the next build. - /// - private void ResetLoggerState() - { - // No state needs resetting - } - /// /// Called when Engine is done with this logger /// From f2a6046e99aba1383f3581fb4e414edca687cd9a Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Wed, 17 Jan 2024 07:45:18 +0100 Subject: [PATCH 3/3] Add comment --- .../DistributedLoggers/ConfigurableForwardingLogger.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs index 5504f448377..8e63fe788e3 100644 --- a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs +++ b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs @@ -289,10 +289,12 @@ private void SetForwardingBasedOnVerbosity(IEventSource eventSource) /// /// Returns the minimum importance of messages logged by this logger. + /// Forwarding logger might be configured to forward messages of particular importance regardless of the verbosity level of said logger. + /// This method properly reflects that. /// /// - /// The minimum message importance corresponding to this logger's verbosity or (MessageImportance.High - 1) - /// if this logger does not log messages of any importance. + /// The minimum message importance corresponding to this logger's verbosity or configuration of forwarding of messages of particular importance level. + /// If this logger is not configured to forward messages of any importance and verbosity is not explicitly set, then (MessageImportance.High - 1) is returned. /// internal MessageImportance GetMinimumMessageImportance() {