SyntaxCircus.AspNetCore.Serilog 0.1.3

dotnet add package SyntaxCircus.AspNetCore.Serilog --version 0.1.3
                    
NuGet\Install-Package SyntaxCircus.AspNetCore.Serilog -Version 0.1.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SyntaxCircus.AspNetCore.Serilog" Version="0.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SyntaxCircus.AspNetCore.Serilog" Version="0.1.3" />
                    
Directory.Packages.props
<PackageReference Include="SyntaxCircus.AspNetCore.Serilog" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SyntaxCircus.AspNetCore.Serilog --version 0.1.3
                    
#r "nuget: SyntaxCircus.AspNetCore.Serilog, 0.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SyntaxCircus.AspNetCore.Serilog@0.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SyntaxCircus.AspNetCore.Serilog&version=0.1.3
                    
Install as a Cake Addin
#tool nuget:?package=SyntaxCircus.AspNetCore.Serilog&version=0.1.3
                    
Install as a Cake Tool

SyntaxCircus.AspNetCore.Serilog

Build NuGet License: MIT

A standard Serilog bootstrap for ASP.NET Core hosts and worker services, with optional File-sink configuration. It targets the shared IHostApplicationBuilder interface, so one setup works for both WebApplicationBuilder and worker-service HostApplicationBuilder.

No support guaranteed. Published as-is and maintained on a best-effort basis. Issues and PRs are welcome, but there's no SLA — fork it or vendor what you need if that's not enough.

Install

dotnet add package SyntaxCircus.AspNetCore.Serilog

Quick start

ASP.NET Core

using SyntaxCircus.AspNetCore.Serilog;

var builder = WebApplication.CreateBuilder(args);
builder.AddStandardSerilog();

var app = builder.Build();
app.UseSerilogRequestLogging(); // ASP.NET Core hosts only

Worker service

using Microsoft.Extensions.Hosting;
using SyntaxCircus.AspNetCore.Serilog;

var builder = Host.CreateApplicationBuilder(args);
builder.AddStandardSerilog();
builder.Services.AddHostedService<Worker>();

using var host = builder.Build();
await host.RunAsync();

AddStandardSerilog() installs a console bootstrap logger for pre-DI startup and an independent full logger for each host. The full logger reads standard Serilog configuration and DI services, adds LogContext enrichment, and is used through normal ILogger<T> injection.

Static logger boundary: Serilog.Log.Logger remains a process-global bootstrap logger. Use DI-provided ILogger<T> for a host's fully configured logger. This keeps multiple concurrent hosts, including parallel WebApplicationFactory tests, isolated from Serilog's global reload/freeze lifecycle.

File logging

using Serilog;

builder.AddStandardSerilog(fileLogging =>
{
    fileLogging.Enabled = true;
    fileLogging.Path = "logs/log-.txt";
    fileLogging.RollingInterval = RollingInterval.Day;
    fileLogging.RetainedFileCountLimit = 14;
    fileLogging.OutputTemplate = "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}";
});

File logging is disabled by default. Relative paths are content-root-relative; omitting Path uses the platform's LocalAppData location under {ApplicationName}/logs/log-.txt. RetainedFileCountLimit = null retains all rolled files, OutputTemplate = null preserves Serilog's standard File-sink format, and Shared = false preserves exclusive file access.

Documentation

  • Usage guide — complete API reference, configuration behavior, file logging, lifecycle details, multiple-host guidance, and troubleshooting.
  • Agent integration guide — decision rules and safe recipes for AI agents modifying consuming applications.
  • Repository agent guide — package contracts and contribution/validation guidance for agents working in this repository.

Contributing

Issues and pull requests are welcome:

  • Keep changes focused, with a clear description of the behavior change.
  • Match the existing code style (see .editorconfig).
  • Update the relevant documentation and tests when behavior changes.
  • Call out any breaking changes to the public API in your PR description.

License

MIT — see LICENSE.txt.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.3 638 8/18/2026
0.1.2 102 8/18/2026
0.1.1 115 8/16/2026