PackSite.Library.Logging.Serilog
3.0.0
Prefix Reserved
dotnet add package PackSite.Library.Logging.Serilog --version 3.0.0
NuGet\Install-Package PackSite.Library.Logging.Serilog -Version 3.0.0
<PackageReference Include="PackSite.Library.Logging.Serilog" Version="3.0.0" />
paket add PackSite.Library.Logging.Serilog --version 3.0.0
#r "nuget: PackSite.Library.Logging.Serilog, 3.0.0"
// Install PackSite.Library.Logging.Serilog as a Cake Addin #addin nuget:?package=PackSite.Library.Logging.Serilog&version=3.0.0 // Install PackSite.Library.Logging.Serilog as a Cake Tool #tool nuget:?package=PackSite.Library.Logging.Serilog&version=3.0.0
PackSite.Library.Logging is a set of .NET 6 and .NET 7 compatible libraries that speed up logging setup and Generic Host bootstrapping with Serilog and Microsoft.Extensions.Logging
.
The libraries simplify and provide a generic solution to the problem described in an article Bootstrap logging with Serilog + ASP.NET Core.
(...) Errors during application start-up are some of the nastiest problems to hit in production. Deployment issues like broken manifests or missing assemblies, incorrect settings, exceptions thrown during IoC container configuration or in the constructors of important components - these can bring start-up to a screeching halt and cause a process exit, without leaving even so much as an error page. (...)
~ nblumhardt (Oct 12, 2020)
Features
- Host bootstrapping that provides application logs during host build, especially when app configuration or Serilog configuration are broken.
- Follows a principal of "always logging something even if host build, logging configuration, or host startup fails critically".
- Simplifies integration tests by providing a simple interface for setting host/program options.
- Simplifies Program.cs by eliminating the need of writing complex logger configurations and try-catch-finally blocks.
- Simplifies Serilog configuration by providing a set of recent enrichers and sinks.
- Supports Serilog and
Microsoft.Extensions.Logging
based bootstrapping. - Supports Entity Framework Migrations generation by bypassing the bootstrapper.
Examples
See Examples folder for all library usage examples.
Quick start
using PackSite.Library.Logging;
using PackSite.Library.Logging.Serilog;
public static async Task Main(string[] args)
{
await CreateHostBuilder(args)
.RunConsoleAsync();
}
private static IHostBuilder CreateHostBuilder(string[] args)
{
return Host
.CreateDefaultBuilder(args)
.UseBootstrapper<SerilogBootstrapper>()
.UseSerilog((context, services, loggerConfiguration) =>
{
loggerConfiguration.ConfigureWithFailSafeDefaults(context.Configuration);
}, preserveStaticLogger: false, writeToProviders: false);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- PackSite.Library.Logging.Abstractions (>= 3.0.0)
- Serilog (>= 3.0.1)
- Serilog.AspNetCore (>= 7.0.0)
- Serilog.Enrichers.Environment (>= 2.2.0)
- Serilog.Enrichers.Memory (>= 1.0.4)
- Serilog.Enrichers.Process (>= 2.0.2)
- Serilog.Enrichers.Thread (>= 3.1.0)
- Serilog.Extensions.Hosting (>= 7.0.0)
- Serilog.Extensions.Logging (>= 7.0.0)
- Serilog.Settings.Configuration (>= 7.0.0)
- Serilog.Sinks.Console (>= 4.1.0)
- Serilog.Sinks.Debug (>= 2.0.0)
- Serilog.Sinks.File (>= 5.0.0)
-
net7.0
- PackSite.Library.Logging.Abstractions (>= 3.0.0)
- Serilog (>= 3.0.1)
- Serilog.AspNetCore (>= 7.0.0)
- Serilog.Enrichers.Environment (>= 2.2.0)
- Serilog.Enrichers.Memory (>= 1.0.4)
- Serilog.Enrichers.Process (>= 2.0.2)
- Serilog.Enrichers.Thread (>= 3.1.0)
- Serilog.Extensions.Hosting (>= 7.0.0)
- Serilog.Extensions.Logging (>= 7.0.0)
- Serilog.Settings.Configuration (>= 7.0.0)
- Serilog.Sinks.Console (>= 4.1.0)
- Serilog.Sinks.Debug (>= 2.0.0)
- Serilog.Sinks.File (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.0 | 814 | 6/21/2023 |