Serilog.Enrichers.Context
3.0.0-develop-00024
See the version list below for details.
dotnet add package Serilog.Enrichers.Context --version 3.0.0-develop-00024
NuGet\Install-Package Serilog.Enrichers.Context -Version 3.0.0-develop-00024
<PackageReference Include="Serilog.Enrichers.Context" Version="3.0.0-develop-00024" />
paket add Serilog.Enrichers.Context --version 3.0.0-develop-00024
#r "nuget: Serilog.Enrichers.Context, 3.0.0-develop-00024"
// Install Serilog.Enrichers.Context as a Cake Addin #addin nuget:?package=Serilog.Enrichers.Context&version=3.0.0-develop-00024&prerelease // Install Serilog.Enrichers.Context as a Cake Tool #tool nuget:?package=Serilog.Enrichers.Context&version=3.0.0-develop-00024&prerelease
Serilog.Enrichers.Context
Enriches Serilog events with information from the environment variables or user provided custom property.
Getting started
Install Serilog.Enrichers.Context from NuGet
Install-Package Serilog.Enrichers.Context
Enriching with environment variables.
Configure logger by calling .Enrich.WithEnvironment(...)
####Example
var logger = new LoggerConfiguration()
.ReadFrom.AppSettings()
.Enrich.WithEnvironment("OS")
.CreateLogger();
logger.Information("This informational message will enrich with OS name");
When a compatible sink is used, in this case Serilog.Sinks.AzureDocumentDB, following log message will be emitted to DocumentDb:
{
"Timestamp": "2016-09-22T07:16:34.0314959-04:00",
"Level": "Information",
"MessageTemplate": "This informational message will enrich with OS name",
"Properties": {
"OS": "Windows_NT"
},
"id": "580bce0b-76d4-f510-60f4-70da00636bc3"
}
Enriching with user defined property.
Configure logger by calling .Enrich.WithProperty(KeyValuePair<string, object>)
.Enrich.WithProperty(...)
is very useful when multiple applications are logging to centralized store and you want to distinguish logs by some unique property for better discoverability.
####Example
var logger = new LoggerConfiguration()
.ReadFrom.AppSettings()
.Enrich.WithProperty(new KeyValuePair<string, object>("applicationId", "demo"));
.CreateLogger();
logger.Information("This informational message will enrich with custom property");
Assuming AzureDocumentDB sink is configured, one should see following log message in Azure DocumentDb collection.
{
"Timestamp": "2016-09-22T07:33:52.9807951-04:00",
"Level": "Information",
"MessageTemplate": "This informational message will enrich with custom property",
"Properties": {
"applicationId": "demo"
},
"id": "9b672004-4e6b-31a2-3e92-5ea49361c312"
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 2.0
- Newtonsoft.Json (>= 11.0.2)
- Serilog (>= 2.6.0)
-
.NETFramework 4.5.2
- Newtonsoft.Json (>= 11.0.2)
- Serilog (>= 2.6.0)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 11.0.2)
- Serilog (>= 2.6.0)
NuGet packages (39)
Showing the top 5 NuGet packages that depend on Serilog.Enrichers.Context:
Package | Downloads |
---|---|
MyJetWallet.Sdk.Service
Package Description |
|
DocWorks.Common
This is common code in DocWorks CMS Application |
|
M5x.Serilog
Macula SeriLog Abstraction |
|
Azasp.Core
Package Description |
|
Swisschain.Sdk.Server
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.6.5 | 1,933,671 | 7/1/2023 |
4.6.0 | 1,401,706 | 7/1/2022 |
4.5.0-develop-00040 | 88,653 | 3/11/2019 |
4.2.0 | 5,479,753 | 1/2/2019 |
4.0.0 | 135,496 | 7/21/2018 |
3.0.0-develop-00024 | 1,971 | 4/21/2018 |
2.4.0 | 437,385 | 1/14/2018 |
2.3.0 | 54,562 | 4/5/2017 |
2.2.37 | 7,523 | 11/26/2016 |
2.0.5 | 5,601 | 9/30/2016 |
1.1.3 | 1,449 | 9/22/2016 |