Serilog.Enrichers.Environment 3.0.1

Serilog.Enrichers.Environment

Enriches Serilog events with information from the execution environment.

Build status NuGet Version

To use the enricher, first install the NuGet package:

dotnet add package Serilog.Enrichers.Environment

Then, apply the enricher to you LoggerConfiguration:

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

The WithMachineName() enricher will add a MachineName property to produced events.

Included enrichers

The package includes:

  • WithMachineName() - adds MachineName based on either %COMPUTERNAME% (Windows) or $HOSTNAME (macOS, Linux)
  • WithEnvironmentUserName() - adds EnvironmentUserName based on USERNAME and USERDOMAIN (if available)
  • WithEnvironmentName() - adds EnvironmentName based on ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT (when both are available then 'ASPNETCORE_ENVIRONMENT' takes precedence, when none are available then the fallback value will be 'Production')
  • WithEnvironmentVariable(string envVarName, string propertyName = null) - adds an <envVarName> property to the log event with the value for the specified environment variable. Optional <propertyName> will override <envVarName> as propertyName.

Copyright © 2016 Serilog Contributors - Provided under the Apache License, Version 2.0.

Showing the top 20 packages that depend on Serilog.Enrichers.Environment.

Packages Downloads
Dis.Common.Logging
Package Description
96
Dis.Common.Logging
Package Description
2,163
Dis.Common.Logging
Package Description
6,926
TNE.Common
Package Description
10,359

.NET Framework 4.6.2

.NET Framework 4.7.1

.NET 6.0

.NET 8.0

.NET Standard 2.0

Version Downloads Last updated
3.0.1 19 06/22/2024
3.0.1-dev-00816 23 06/23/2024
3.0.0 17 06/16/2024
3.0.0-dev-00811 14 06/18/2024
3.0.0-dev-00806 66 11/18/2023
3.0.0-dev-00804 19 10/29/2023
3.0.0-dev-00802 25 10/28/2023
2.3.1-dev-00801 18 10/22/2023
2.3.0 17 10/05/2023
2.3.0-dev-00793 36 06/18/2023
2.3.0-dev-00792 25 06/24/2023
2.3.0-dev-00791 60 06/24/2023
2.2.1-dev-00787 3,194 08/13/2022
2.2.0 25,678 06/27/2022
2.2.0-dev-00784 37 09/12/2022
2.2.0-dev-00780 28 09/12/2022
2.2.0-dev-00777 35 09/12/2022
2.2.0-dev-00773 40 09/12/2022
2.2.0-dev-00770 91 09/25/2022
2.2.0-dev-00761 51 09/12/2022
2.1.3 1,939 06/27/2022
2.1.3-dev-00759 45 09/12/2022
2.1.3-dev-00752 42 09/12/2022
2.1.3-dev-00748 84 09/12/2022
2.1.3-dev-00746 61 09/12/2022
2.1.3-dev-00736 31 09/12/2022
2.1.2 38 09/12/2022
2.1.2-dev-00731 53 09/12/2022
2.1.1 37 09/17/2022
2.1.1-dev-00727 24 09/12/2022
2.1.1-dev-00724 51 09/12/2022
2.1.0 40 09/12/2022
2.1.0-dev-00719 33 09/24/2022
2.0.1 64 09/12/2022
2.0.0 37 09/12/2022
2.0.0-rc-710 80 09/23/2022
2.0.0-rc-708 46 09/12/2022
2.0.0-beta-701 37 09/12/2022
2.0.0-beta-700 41 09/12/2022
2.0.0-beta-521 35 05/02/2023
2.0.0-beta-519 35 09/12/2022
2.0.0-beta-516 28 09/12/2022
2.0.0-beta-515 39 09/12/2022
2.0.0-beta-513 38 09/12/2022
2.0.0-beta-511 45 09/12/2022
2.0.0-beta-509 56 09/12/2022
2.0.0-beta-507 35 09/12/2022
2.0.0-beta-505 55 09/12/2022
2.0.0-beta-502 24 09/25/2022
2.0.0-beta-499 61 09/12/2022