Installation
Install AlmightyShogun.Logging in the application that should register Serilog with the package's custom console formatter. The package targets net10.0 and supports both IServiceCollection and IHostBuilder registration styles.
sh
dotnet add package AlmightyShogun.LoggingDependencies
Microsoft.Extensions.DependencyInjection.Abstractions10.0.8— provides service collection logging registration APIs.Microsoft.Extensions.Hosting10.0.8— provides host-builder integration.Serilog4.3.1— provides the core logger configuration and logger types.Serilog.AspNetCore10.0.0— provides Serilog integration for hosted and ASP.NET Core applications.Serilog.Extensions.Logging10.0.0— connects Serilog toMicrosoft.Extensions.Logging.Serilog.Settings.Configuration10.0.0— reads Serilog configuration fromIConfiguration.Serilog.Sinks.Async2.1.0— writes log events through an asynchronous sink wrapper.Serilog.Sinks.Console6.1.1— writes formatted log output to the console.
Startup Registration
Register logging through services when startup code configures logging from IServiceCollection, or through the IHostBuilder when the application configures Serilog at the host level.
csharp
using AlmightyShogun.Logging;
builder.Services.AddCustomLogging(builder.Configuration);csharp
using AlmightyShogun.Logging;
builder.Host.AddCustomLogging(builder.Configuration);