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
SanedBuildingBlocks
This package built for OIG-Saned
360
SanedBuildingBlocks
This package built for OIG-Saned
233
SanedBuildingBlocks
This package built for OIG-Saned
202
SanedBuildingBlocks
This package built for OIG-Saned
104
SanedBuildingBlocks
This package built for OIG-Saned
69
SanedBuildingBlocks
This package built for OIG-Saned
62
SanedBuildingBlocks
This package built for OIG-Saned
53
SanedBuildingBlocks
This package built for OIG-Saned
47
SanedBuildingBlocks
This package built for OIG-Saned
45
SanedBuildingBlocks
KitSysCo Building Blocks
42
SanedBuildingBlocks
This package built for OIG-Saned
37
SanedBuildingBlocks
This package built for OIG-Saned
34
SanedBuildingBlocks
This package built for OIG-Saned
25
SanedBuildingBlocks
This package built for OIG-Saned
24
SanedBuildingBlocks
This package built for OIG-Saned
22
SanedBuildingBlocks
This package built for OIG-Saned
20
SanedBuildingBlocks
This package built for OIG-Saned
19
SanedBuildingBlocks
This package built for OIG-Saned
18

.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 27 03/09/2025
3.0.1-dev-00816 20 03/09/2025
3.0.0 25 03/09/2025
3.0.0-dev-00811 25 03/09/2025
3.0.0-dev-00806 23 03/09/2025
3.0.0-dev-00804 23 03/09/2025
3.0.0-dev-00802 25 03/09/2025
2.3.1-dev-00801 22 03/09/2025
2.3.0 22 03/09/2025
2.3.0-dev-00793 21 03/09/2025
2.3.0-dev-00792 25 03/09/2025
2.3.0-dev-00791 23 03/09/2025
2.2.1-dev-00787 21 03/09/2025
2.2.0 25 06/26/2023
2.2.0-dev-00784 26 03/09/2025
2.2.0-dev-00780 26 03/09/2025
2.2.0-dev-00777 24 03/09/2025
2.2.0-dev-00773 25 03/09/2025
2.2.0-dev-00770 24 03/09/2025
2.2.0-dev-00761 23 03/09/2025
2.1.3 23 06/19/2023
2.1.3-dev-00759 22 03/09/2025
2.1.3-dev-00752 22 03/09/2025
2.1.3-dev-00748 22 03/09/2025
2.1.3-dev-00746 22 03/09/2025
2.1.3-dev-00736 22 03/09/2025
2.1.2 22 03/09/2025
2.1.2-dev-00731 23 03/09/2025
2.1.1 23 03/09/2025
2.1.1-dev-00727 23 03/09/2025
2.1.1-dev-00724 23 03/09/2025
2.1.0 22 03/09/2025
2.1.0-dev-00719 21 03/09/2025
2.0.1 23 03/09/2025
2.0.0 23 03/09/2025
2.0.0-rc-710 23 03/09/2025
2.0.0-rc-708 23 03/09/2025
2.0.0-beta-701 22 03/09/2025
2.0.0-beta-700 22 03/09/2025
2.0.0-beta-521 22 03/09/2025
2.0.0-beta-519 23 03/09/2025
2.0.0-beta-516 25 03/09/2025
2.0.0-beta-515 23 03/09/2025
2.0.0-beta-513 23 03/09/2025
2.0.0-beta-511 23 03/09/2025
2.0.0-beta-509 25 03/09/2025
2.0.0-beta-507 25 03/09/2025
2.0.0-beta-505 22 03/09/2025
2.0.0-beta-502 25 03/09/2025
2.0.0-beta-499 23 03/09/2025