Skip to content

Commit

Permalink
Still use RegisteredLogger when provided with a logger
Browse files Browse the repository at this point in the history
Fixes #63
  • Loading branch information
JSkimming committed Jul 18, 2022
1 parent fcc0963 commit 2b5895c
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public static IHostBuilder UseSerilog(
{
// This won't (and shouldn't) take ownership of the logger.
collection.AddSingleton(logger);

// Still need to use RegisteredLogger as it is used by ConfigureDiagnosticContext.
collection.AddSingleton(new RegisteredLogger(logger));
}
bool useRegisteredLogger = logger != null;
ConfigureDiagnosticContext(collection, useRegisteredLogger);
Expand Down

0 comments on commit 2b5895c

Please sign in to comment.