Skip to content

Commit

Permalink
single line logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsonax committed Apr 27, 2024
1 parent cbd7d9f commit b5ca2cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions CleanAspCore.Api.Tests/TestSetup/NunitLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ public sealed class NunitLogger(TextWriter output, string name) : ILogger, IDisp

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{

output.WriteLine($"[{DateTime.Now}] {logLevel}: {name}[{eventId.Id}]{output.NewLine}" +
$"{formatter(state, exception)}");
output.WriteLine($"[{DateTime.Now}] {logLevel}: {name}[{eventId.Id}] => {formatter(state, exception)}");
}

public void Dispose() { }
Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/TestSetup/TestWebApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override IHost CreateHost(IHostBuilder builder)
builder.ConfigureLogging(loggingBuilder =>
{
loggingBuilder.ClearProviders();
loggingBuilder.Services.AddSingleton(_loggerProvider);
loggingBuilder.AddProvider(_loggerProvider);
});

var app = base.CreateHost(builder);
Expand Down

0 comments on commit b5ca2cc

Please sign in to comment.