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
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
6
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
5
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
2
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
1

.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 6 04.06.2025
3.0.1-dev-00816 5 04.06.2025
3.0.0 5 04.06.2025
3.0.0-dev-00811 4 04.06.2025
3.0.0-dev-00806 4 04.06.2025
3.0.0-dev-00804 5 04.06.2025
3.0.0-dev-00802 5 04.06.2025
2.3.1-dev-00801 5 04.06.2025
2.3.0 4 04.06.2025
2.3.0-dev-00793 5 04.06.2025
2.3.0-dev-00792 5 04.06.2025
2.3.0-dev-00791 5 04.06.2025
2.2.1-dev-00787 5 04.06.2025
2.2.0 5 04.06.2025
2.2.0-dev-00784 4 04.06.2025
2.2.0-dev-00780 5 04.06.2025
2.2.0-dev-00777 4 04.06.2025
2.2.0-dev-00773 4 04.06.2025
2.2.0-dev-00770 5 04.06.2025
2.2.0-dev-00761 5 04.06.2025
2.1.3 5 04.06.2025
2.1.3-dev-00759 5 04.06.2025
2.1.3-dev-00752 4 04.06.2025
2.1.3-dev-00748 4 04.06.2025
2.1.3-dev-00746 5 04.06.2025
2.1.3-dev-00736 5 04.06.2025
2.1.2 5 04.06.2025
2.1.2-dev-00731 5 04.06.2025
2.1.1 5 04.06.2025
2.1.1-dev-00727 5 04.06.2025
2.1.1-dev-00724 5 04.06.2025
2.1.0 5 04.06.2025
2.1.0-dev-00719 5 04.06.2025
2.0.1 5 04.06.2025
2.0.0 5 04.06.2025
2.0.0-rc-710 5 04.06.2025
2.0.0-rc-708 5 04.06.2025
2.0.0-beta-701 5 04.06.2025
2.0.0-beta-700 5 04.06.2025
2.0.0-beta-521 5 04.06.2025
2.0.0-beta-519 5 04.06.2025
2.0.0-beta-516 5 04.06.2025
2.0.0-beta-515 5 04.06.2025
2.0.0-beta-513 5 04.06.2025
2.0.0-beta-511 4 04.06.2025
2.0.0-beta-509 4 04.06.2025
2.0.0-beta-507 4 04.06.2025
2.0.0-beta-505 5 04.06.2025
2.0.0-beta-502 6 24.05.2025
2.0.0-beta-499 4 04.06.2025