File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ public static IWebHostBuilder UseSerilog(
88
88
{
89
89
if ( builder == null ) throw new ArgumentNullException ( nameof ( builder ) ) ;
90
90
if ( configureLogger == null ) throw new ArgumentNullException ( nameof ( configureLogger ) ) ;
91
+
91
92
builder . ConfigureServices ( ( context , collection ) =>
92
93
{
93
94
var loggerConfiguration = new LoggerConfiguration ( ) ;
@@ -105,13 +106,13 @@ public static IWebHostBuilder UseSerilog(
105
106
ILogger registeredLogger = null ;
106
107
if ( preserveStaticLogger )
107
108
{
108
- // Passing a `null` logger to `SerilogLoggerFactory` results in disposal via
109
- // `Log.CloseAndFlush()`, which additionally replaces the static logger with a no-op.
110
- Log . Logger = logger ;
109
+ registeredLogger = logger ;
111
110
}
112
111
else
113
112
{
114
- registeredLogger = logger ;
113
+ // Passing a `null` logger to `SerilogLoggerFactory` results in disposal via
114
+ // `Log.CloseAndFlush()`, which additionally replaces the static logger with a no-op.
115
+ Log . Logger = logger ;
115
116
}
116
117
117
118
collection . AddSingleton < ILoggerFactory > ( services =>
You can’t perform that action at this time.
0 commit comments