diff --git a/src/Hosting/Conventions/SerilogHostingConvention.cs b/src/Hosting/Conventions/SerilogHostingConvention.cs index f5c26fa16..41dd0c752 100644 --- a/src/Hosting/Conventions/SerilogHostingConvention.cs +++ b/src/Hosting/Conventions/SerilogHostingConvention.cs @@ -63,12 +63,12 @@ public void Register(IConventionContext context, IHostApplicationBuilder builder _options.PreserveStaticLogger, _options.WriteToProviders ); - - if (context.Get() != null) - // ReSharper disable once NullableWarningSuppressionIsUsed - builder.Services.AddSingleton(context.Get()!); } + if (context.Get() != null) + // ReSharper disable once NullableWarningSuppressionIsUsed + builder.Services.AddSingleton(context.Get()!); + if (_options.WriteToProviders) return; builder.OnHostStarting( diff --git a/src/Serilog/LaunchPadLoggingOptions.cs b/src/Serilog/LaunchPadLoggingOptions.cs index eebe219d7..c8f19bece 100644 --- a/src/Serilog/LaunchPadLoggingOptions.cs +++ b/src/Serilog/LaunchPadLoggingOptions.cs @@ -3,6 +3,7 @@ namespace Rocket.Surgery.LaunchPad.Serilog; /// /// RocketSerilogOptions. /// +[PublicAPI] public class LaunchPadLoggingOptions { /// @@ -30,7 +31,7 @@ public class LaunchPadLoggingOptions /// /// Base option from the serilog package /// - public bool WriteToProviders { get; set; } = false; + public bool WriteToProviders { get; set; } /// /// Base option from the serilog package