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
34
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
36
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
38
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
40
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
41
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
42
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
43
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
44
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
45
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
48
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
50
Serilog.AspNetCore.Plus
Serilog support for ASP.NET Core logging with some plus features
134

.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 58 07/19/2024
3.0.1-dev-00816 40 07/19/2024
3.0.0 53 07/19/2024
3.0.0-dev-00811 42 07/19/2024
3.0.0-dev-00806 51 07/19/2024
3.0.0-dev-00804 40 07/19/2024
3.0.0-dev-00802 46 07/20/2024
2.3.1-dev-00801 51 07/19/2024
2.3.0 46 06/28/2024
2.3.0-dev-00793 44 07/19/2024
2.3.0-dev-00792 50 07/19/2024
2.3.0-dev-00791 49 07/19/2024
2.2.1-dev-00787 35 07/19/2024
2.2.0 62 02/05/2024
2.2.0-dev-00784 51 07/19/2024
2.2.0-dev-00780 39 07/19/2024
2.2.0-dev-00777 44 07/19/2024
2.2.0-dev-00773 56 07/19/2024
2.2.0-dev-00770 38 07/19/2024
2.2.0-dev-00761 46 07/19/2024
2.1.3 41 07/19/2024
2.1.3-dev-00759 55 07/19/2024
2.1.3-dev-00752 41 07/19/2024
2.1.3-dev-00748 48 07/19/2024
2.1.3-dev-00746 47 07/19/2024
2.1.3-dev-00736 42 07/19/2024
2.1.2 46 07/19/2024
2.1.2-dev-00731 51 07/19/2024
2.1.1 57 07/19/2024
2.1.1-dev-00727 51 07/19/2024
2.1.1-dev-00724 49 07/19/2024
2.1.0 48 07/19/2024
2.1.0-dev-00719 47 07/19/2024
2.0.1 49 07/19/2024
2.0.0 44 07/19/2024
2.0.0-rc-710 47 07/19/2024
2.0.0-rc-708 42 07/19/2024
2.0.0-beta-701 49 07/19/2024
2.0.0-beta-700 39 07/19/2024
2.0.0-beta-521 39 07/19/2024
2.0.0-beta-519 41 07/19/2024
2.0.0-beta-516 39 07/19/2024
2.0.0-beta-515 44 07/19/2024
2.0.0-beta-513 40 07/19/2024
2.0.0-beta-511 41 07/19/2024
2.0.0-beta-509 44 07/19/2024
2.0.0-beta-507 54 07/19/2024
2.0.0-beta-505 44 07/19/2024
2.0.0-beta-502 52 07/19/2024
2.0.0-beta-499 39 07/19/2024