Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
If Hide Test Output is Enabled, then don't forward logs to the IOutpu…
…tDevice
  • Loading branch information
thomhurst committed May 11, 2025
commit 57b086bb61f02ad734ace8e315ceaaa3ea08ba73
10 changes: 7 additions & 3 deletions TUnit.Engine/Logging/TUnitFrameworkLogger.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
using Microsoft.Testing.Platform.Extensions;
using Microsoft.Testing.Platform.CommandLine;
using Microsoft.Testing.Platform.Extensions;
using Microsoft.Testing.Platform.Extensions.OutputDevice;
using Microsoft.Testing.Platform.Logging;
using Microsoft.Testing.Platform.OutputDevice;
using TUnit.Engine.CommandLineProviders;
using LogLevel = TUnit.Core.Logging.LogLevel;

namespace TUnit.Engine.Logging;

internal class TUnitFrameworkLogger(IExtension extension, IOutputDevice outputDevice, ILogger logger)
internal class TUnitFrameworkLogger(IExtension extension, IOutputDevice outputDevice, ILogger logger, ICommandLineOptions commandLineOptions)
: IOutputDeviceDataProducer, global::TUnit.Core.Logging.ILogger
{
private readonly bool _hideTestOutput = commandLineOptions.IsOptionSet(HideTestOutputCommandProvider.HideTestOutput);

private readonly MTPLoggerAdapter _adapter = new(logger);

public Task<bool> IsEnabledAsync()
Expand Down Expand Up @@ -78,6 +82,6 @@ private static ConsoleColor GetConsoleColor(LogLevel logLevel)

public bool IsEnabled(LogLevel logLevel)
{
return logger.IsEnabled(MTPLoggerAdapter.Map(logLevel));
return !_hideTestOutput && logger.IsEnabled(MTPLoggerAdapter.Map(logLevel));
}
}
Loading