You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This won't (and shouldn't) take ownership of the logger.
70
-
collection.AddSingleton(logger);
71
-
}
68
+
ConfigureServices(collection,logger);
72
69
});
73
70
74
71
returnbuilder;
@@ -80,7 +77,7 @@ public static IHostBuilder UseSerilog(
80
77
/// The logger will be shut down when application services are disposed.
81
78
/// </remarks>
82
79
/// <param name="builder">The host builder to configure.</param>
83
-
/// <param name="configureLogger">The delegate for configuring the <see cref="LoggerConfiguration" /> that will be used to construct a <see cref="Logger" />.</param>
80
+
/// <param name="configureLogger">The delegate for configuring the <see cref="LoggerConfiguration" /> that will be used to construct a <see cref="Microsoft.Extensions.Logging.Logger" />.</param>
84
81
/// <param name="preserveStaticLogger">Indicates whether to preserve the value of <see cref="Log.Logger"/>.</param>
85
82
/// <param name="writeToProviders">By default, Serilog does not write events to <see cref="ILoggerProvider"/>s registered through
86
83
/// the Microsoft.Extensions.Logging API. Normally, equivalent Serilog sinks are used in place of providers. Specify
@@ -109,9 +106,6 @@ public static IHostBuilder UseSerilog(
109
106
configureLogger(context,loggerConfiguration);
110
107
varlogger=loggerConfiguration.CreateLogger();
111
108
112
-
// This won't (and shouldn't) take ownership of the logger.
113
-
collection.AddSingleton(logger);
114
-
115
109
ILoggerregisteredLogger=null;
116
110
if(preserveStaticLogger)
117
111
{
@@ -136,8 +130,30 @@ public static IHostBuilder UseSerilog(
0 commit comments