Serilog.Enrichers.Environment 3.0.1-dev-00816

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
109
Dis.Common.Logging
Package Description
2,179
Dis.Common.Logging
Package Description
6,940
TNE.Common
Package Description
10,375

.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 47 06/22/2024
3.0.1-dev-00816 40 06/23/2024
3.0.0 33 06/16/2024
3.0.0-dev-00811 27 06/18/2024
3.0.0-dev-00806 84 11/18/2023
3.0.0-dev-00804 34 10/29/2023
3.0.0-dev-00802 40 10/28/2023
2.3.1-dev-00801 30 10/22/2023
2.3.0 38 10/05/2023
2.3.0-dev-00793 51 06/18/2023
2.3.0-dev-00792 38 06/24/2023
2.3.0-dev-00791 73 06/24/2023
2.2.1-dev-00787 3,207 08/13/2022
2.2.0 25,693 06/27/2022
2.2.0-dev-00784 54 09/12/2022
2.2.0-dev-00780 43 09/12/2022
2.2.0-dev-00777 49 09/12/2022
2.2.0-dev-00773 58 09/12/2022
2.2.0-dev-00770 104 09/25/2022
2.2.0-dev-00761 66 09/12/2022
2.1.3 1,956 06/27/2022
2.1.3-dev-00759 62 09/12/2022
2.1.3-dev-00752 57 09/12/2022
2.1.3-dev-00748 95 09/12/2022
2.1.3-dev-00746 74 09/12/2022
2.1.3-dev-00736 43 09/12/2022
2.1.2 51 09/12/2022
2.1.2-dev-00731 67 09/12/2022
2.1.1 52 09/17/2022
2.1.1-dev-00727 37 09/12/2022
2.1.1-dev-00724 65 09/12/2022
2.1.0 54 09/12/2022
2.1.0-dev-00719 46 09/24/2022
2.0.1 76 09/12/2022
2.0.0 50 09/12/2022
2.0.0-rc-710 94 09/23/2022
2.0.0-rc-708 58 09/12/2022
2.0.0-beta-701 51 09/12/2022
2.0.0-beta-700 52 09/12/2022
2.0.0-beta-521 51 05/02/2023
2.0.0-beta-519 46 09/12/2022
2.0.0-beta-516 46 09/12/2022
2.0.0-beta-515 52 09/12/2022
2.0.0-beta-513 51 09/12/2022
2.0.0-beta-511 63 09/12/2022
2.0.0-beta-509 69 09/12/2022
2.0.0-beta-507 49 09/12/2022
2.0.0-beta-505 69 09/12/2022
2.0.0-beta-502 38 09/25/2022
2.0.0-beta-499 76 09/12/2022