Skip to content

Commit

Permalink
Update LoggingBuilderExtensions for test output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
frankhaugen committed Jan 3, 2024
1 parent 11b1b90 commit 93e4e64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Frank.Testing.Logging/LoggingBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

using Xunit.Abstractions;

namespace Frank.Testing.Logging;

public static class LoggingBuilderExtensions
Expand All @@ -15,9 +17,10 @@ public static class LoggingBuilderExtensions
/// <param name="outputHelper">The ITestOutputHelper to redirect the logging output to.</param>
/// <param name="logLevel">The log level to use for the test logging. Default is LogLevel.Debug.</param>
/// <returns>The modified ILoggingBuilder with the test logging added.</returns>
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<IFlow, TestLoggingOutputFlow>();
return builder;
}
Expand Down

0 comments on commit 93e4e64

Please sign in to comment.