Enriches Serilog events with information from the process environment using assembly information.
To use the enricher, first install the NuGet package:
Install-Package Collector.Serilog.Enrichers.Assembly
Then, apply the enricher to your LoggerConfiguration
:
Log.Logger = new LoggerConfiguration()
.Enrich.With<SourceSystemEnricher<ClassInAssemblyOfSourceSystem>>()
// ...other configuration...
.CreateLogger();
The package includes:
SourceSystemEnricher<T>
- addsSourceSystemEnricher
based on the name of the assembly thatT
resides in.SourceSystemInformationalVersionEnricher<T>
- addsSourceSystemInformationalVersionEnricher
based on the assembly's informational version.