From 93e4e64adefd7a8b9eb9a4039a651bdd94a82827 Mon Sep 17 00:00:00 2001 From: "Frank R. Haugen" Date: Thu, 4 Jan 2024 00:32:08 +0100 Subject: [PATCH] Update LoggingBuilderExtensions for test output A reference to Xunit.Abstractions has been added in LoggingBuilderExtensions.cs. The method AddPulseFlowTestLoggingProvider has been adjusted to include an ITestOutputHelper and a LogLevel parameter. This enables the redirection of log output to help facilitate testing and debugging. --- Frank.Testing.Logging/LoggingBuilderExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Frank.Testing.Logging/LoggingBuilderExtensions.cs b/Frank.Testing.Logging/LoggingBuilderExtensions.cs index c635710..71862b8 100644 --- a/Frank.Testing.Logging/LoggingBuilderExtensions.cs +++ b/Frank.Testing.Logging/LoggingBuilderExtensions.cs @@ -4,6 +4,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Xunit.Abstractions; + namespace Frank.Testing.Logging; public static class LoggingBuilderExtensions @@ -15,9 +17,10 @@ public static class LoggingBuilderExtensions /// The ITestOutputHelper to redirect the logging output to. /// The log level to use for the test logging. Default is LogLevel.Debug. /// The modified ILoggingBuilder with the test logging added. - public static ILoggingBuilder AddPulseFlowTestLoggingProvider(this ILoggingBuilder builder) + public static ILoggingBuilder AddPulseFlowTestLoggingProvider(this ILoggingBuilder builder, ITestOutputHelper outputHelper, LogLevel logLevel = LogLevel.Debug) { builder.AddPulseFlow(); + builder.Services.AddSingleton(outputHelper); builder.Services.AddSingleton(); return builder; }