Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1.19 KB

README.md

File metadata and controls

31 lines (20 loc) · 1.19 KB

Serilog.Enrichers.AssemblyName

Enriches Serilog events with information from the assembly.

NuGet Version

To use the enricher, first install the NuGet package:

Install-Package Serilog.Enrichers.AssemblyName

Then, apply the enricher to your LoggerConfiguration:

Log.Logger = new LoggerConfiguration()
    .Enrich.WithAssemblyName()
    .Enrich.WithAssemblyVersion()
    // ...other configuration...
    .CreateLogger();

The WithAssemblyName() enricher will add an AssemblyName property to produced events.

The WithAssemblyVersion() enricher will add an AssemblyVersion property to produced events.

The WithAssemblyInformationalVersion() enricher will add an AssemblyInformationalVersion property to produced events.

The assembly is determined by Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(). If you need to specify the assembly, you can provide a type using WithAssemblyName<T>().

To use semantic versioning, {version.Major}.{version.Minor}.{version.Build}, call WithAssemblyVersion(true).