Skip to content

Commit

Permalink
Removed ClearProviders (#1996)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-driscoll authored May 3, 2024
1 parent bcb6cdd commit 45ce340
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Hosting/Conventions/SerilogHostingConvention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public void Register(IConventionContext context, IHostApplicationBuilder builder
_options.PreserveStaticLogger,
_options.WriteToProviders
);

if (context.Get<ILoggerFactory>() != null)
// ReSharper disable once NullableWarningSuppressionIsUsed
builder.Services.AddSingleton(context.Get<ILoggerFactory>()!);
}

if (context.Get<ILoggerFactory>() != null)
// ReSharper disable once NullableWarningSuppressionIsUsed
builder.Services.AddSingleton(context.Get<ILoggerFactory>()!);

if (_options.WriteToProviders) return;

builder.OnHostStarting(
Expand Down
3 changes: 2 additions & 1 deletion src/Serilog/LaunchPadLoggingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace Rocket.Surgery.LaunchPad.Serilog;
/// <summary>
/// RocketSerilogOptions.
/// </summary>
[PublicAPI]
public class LaunchPadLoggingOptions
{
/// <summary>
Expand Down Expand Up @@ -30,7 +31,7 @@ public class LaunchPadLoggingOptions
/// <summary>
/// Base option from the serilog package
/// </summary>
public bool WriteToProviders { get; set; } = false;
public bool WriteToProviders { get; set; }

/// <summary>
/// Base option from the serilog package
Expand Down

0 comments on commit 45ce340

Please sign in to comment.