Serilog.Enrichers.Environment 3.0.0-dev-00811

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
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
83
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
89
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
92
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
95
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
96
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
97
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
99
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
100
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
101
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
102
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
105
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
106
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
107
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
110
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
210

.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 119 07/19/2024
3.0.1-dev-00816 88 07/19/2024
3.0.0 101 07/19/2024
3.0.0-dev-00811 90 07/19/2024
3.0.0-dev-00806 97 07/19/2024
3.0.0-dev-00804 85 07/19/2024
3.0.0-dev-00802 90 07/20/2024
2.3.1-dev-00801 96 07/19/2024
2.3.0 92 06/28/2024
2.3.0-dev-00793 85 07/19/2024
2.3.0-dev-00792 97 07/19/2024
2.3.0-dev-00791 97 07/19/2024
2.2.1-dev-00787 81 07/19/2024
2.2.0 110 02/05/2024
2.2.0-dev-00784 93 07/19/2024
2.2.0-dev-00780 90 07/19/2024
2.2.0-dev-00777 97 07/19/2024
2.2.0-dev-00773 106 07/19/2024
2.2.0-dev-00770 92 07/19/2024
2.2.0-dev-00761 105 07/19/2024
2.1.3 87 07/19/2024
2.1.3-dev-00759 100 07/19/2024
2.1.3-dev-00752 95 07/19/2024
2.1.3-dev-00748 102 07/19/2024
2.1.3-dev-00746 99 07/19/2024
2.1.3-dev-00736 86 07/19/2024
2.1.2 91 07/19/2024
2.1.2-dev-00731 100 07/19/2024
2.1.1 107 07/19/2024
2.1.1-dev-00727 105 07/19/2024
2.1.1-dev-00724 99 07/19/2024
2.1.0 104 07/19/2024
2.1.0-dev-00719 101 07/19/2024
2.0.1 95 07/19/2024
2.0.0 95 07/19/2024
2.0.0-rc-710 100 07/19/2024
2.0.0-rc-708 100 07/19/2024
2.0.0-beta-701 98 07/19/2024
2.0.0-beta-700 97 07/19/2024
2.0.0-beta-521 95 07/19/2024
2.0.0-beta-519 90 07/19/2024
2.0.0-beta-516 98 07/19/2024
2.0.0-beta-515 88 07/19/2024
2.0.0-beta-513 87 07/19/2024
2.0.0-beta-511 90 07/19/2024
2.0.0-beta-509 99 07/19/2024
2.0.0-beta-507 102 07/19/2024
2.0.0-beta-505 95 07/19/2024
2.0.0-beta-502 106 07/19/2024
2.0.0-beta-499 90 07/19/2024