Class AppBuilderSerilogExtensions
- Namespace
- Ploch.CommandLine.Spectre.Serilog
- Assembly
- Ploch.CommandLine.Spectre.Serilog.dll
Provides the AppBuilder entry point for opting an application in to Serilog logging.
public static class AppBuilderSerilogExtensions
- Inheritance
-
AppBuilderSerilogExtensions
- Inherited Members
Remarks
Ploch.CommandLine.Spectre does not register a logging provider of its own: an application logs
through the providers the host installs by default. Calling UseSerilog(AppBuilder, string?, string?, string?, CultureInfo?) on the builder
replaces them with Serilog, configured by AddSerilog(IServiceCollection, IConfiguration?, string?, string?, string?, CultureInfo?) with the
predefined sinks — a rolling log file, a separate file for warnings and above, and the Spectre.Console
console sink — and any further settings read from the Serilog section of the host configuration.
The registration is queued through ConfigureServices(Action<HostBuilderContext, IServiceCollection>), so it takes its place in the builder's ordered sequence of service delegates and sees the host's configuration.
Methods
- UseSerilog(AppBuilder, string?, string?, string?, CultureInfo?)
Registers Serilog as the application's logging provider with the predefined command-line configuration.