From c7f86549554ab47bf11ebe10f363628afd85ff30 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 7 Jun 2024 15:48:39 +1000 Subject: [PATCH 1/4] Serilog 4 updates; unpublish enricher types accessible via extensions --- .../.idea/.gitignore | 13 +++ .../.idea/encodings.xml | 4 + .../.idea/indexLayout.xml | 8 ++ .../.idea/vcs.xml | 6 + Build.ps1 | 11 -- README.md | 6 +- appveyor.yml | 35 +++--- serilog-enrichers-environment.sln | 2 +- .../Enrichers/CachedPropertyEnricher.cs | 43 ++++--- .../Enrichers/EnvironmentNameEnricher.cs | 44 ++++--- .../Enrichers/EnvironmentUserNameEnricher.cs | 36 +++--- .../Enrichers/EnvironmentVariableEnricher.cs | 44 ++++--- .../Enrichers/MachineNameEnricher.cs | 36 ++---- ...nvironmentLoggerConfigurationExtensions.cs | 107 +++++++++--------- .../Properties/AssemblyInfo.cs | 6 - .../Serilog.Enrichers.Environment.csproj | 72 ++++++------ ...Serilog.Enrichers.Environment.Tests.csproj | 8 +- .../Support/DelegateDisposable.cs | 4 +- 18 files changed, 231 insertions(+), 254 deletions(-) create mode 100644 .idea/.idea.serilog-enrichers-environment/.idea/.gitignore create mode 100644 .idea/.idea.serilog-enrichers-environment/.idea/encodings.xml create mode 100644 .idea/.idea.serilog-enrichers-environment/.idea/indexLayout.xml create mode 100644 .idea/.idea.serilog-enrichers-environment/.idea/vcs.xml delete mode 100644 src/Serilog.Enrichers.Environment/Properties/AssemblyInfo.cs diff --git a/.idea/.idea.serilog-enrichers-environment/.idea/.gitignore b/.idea/.idea.serilog-enrichers-environment/.idea/.gitignore new file mode 100644 index 0000000..65b0d27 --- /dev/null +++ b/.idea/.idea.serilog-enrichers-environment/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/modules.xml +/.idea.serilog-enrichers-environment.iml +/contentModel.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.serilog-enrichers-environment/.idea/encodings.xml b/.idea/.idea.serilog-enrichers-environment/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.serilog-enrichers-environment/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.serilog-enrichers-environment/.idea/indexLayout.xml b/.idea/.idea.serilog-enrichers-environment/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.serilog-enrichers-environment/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.serilog-enrichers-environment/.idea/vcs.xml b/.idea/.idea.serilog-enrichers-environment/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.serilog-enrichers-environment/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Build.ps1 b/Build.ps1 index fab3228..d85a1f2 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -46,15 +46,4 @@ foreach ($test in gci test/*.Tests) { Pop-Location } -foreach ($test in ls test/*.PerformanceTests) { - Push-Location $test - - echo "build: Building performance test project in $test" - - & dotnet build -c Release - if($LASTEXITCODE -ne 0) { exit 2 } - - Pop-Location -} - Pop-Location diff --git a/README.md b/README.md index 15923d1..7675749 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Serilog.Enrichers.Environment -Enriches Serilog events with information from the process environment. +Enriches Serilog events with information from the execution environment. [![Build status](https://ci.appveyor.com/api/projects/status/yfbvbdxd5vwh6955?svg=true)](https://ci.appveyor.com/project/serilog/serilog-enrichers-environment) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Enrichers.Environment.svg?style=flat)](https://www.nuget.org/packages/Serilog.Enrichers.Environment/) To use the enricher, first install the NuGet package: ```powershell -Install-Package Serilog.Enrichers.Environment +dotnet add package Serilog.Enrichers.Environment ``` Then, apply the enricher to you `LoggerConfiguration`: @@ -28,6 +28,6 @@ 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 `` property to the log event with the value for the specified enviroment variable. Optional `` will override `` as propertyName. + * `WithEnvironmentVariable(string envVarName, string propertyName = null)` - adds an `` property to the log event with the value for the specified environment variable. Optional `` will override `` as propertyName. Copyright © 2016 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html). diff --git a/appveyor.yml b/appveyor.yml index 6acb608..81bd95e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,26 +1,23 @@ version: '{build}' skip_tags: true image: Visual Studio 2022 -configuration: Release -install: - - ps: mkdir -Force ".\build\" | Out-Null - build_script: -- ps: ./Build.ps1 + - pwsh: ./Build.ps1 test: off artifacts: -- path: artifacts/Serilog.*.nupkg + - path: artifacts/Serilog.*.nupkg deploy: -- provider: NuGet - api_key: - secure: Fh92tRIFbe1FAiyD8lTThWgAorQ1vV+eFYMlUK0iLHBBenJcy/UYc1qj6kgHvUcO - skip_symbols: true - on: - branch: /^(main|dev)$/ -- provider: GitHub - auth_token: - secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX - artifact: /Serilog.*\.nupkg/ - tag: v$(appveyor_build_version) - on: - branch: main + - provider: NuGet + api_key: + secure: Fh92tRIFbe1FAiyD8lTThWgAorQ1vV+eFYMlUK0iLHBBenJcy/UYc1qj6kgHvUcO + skip_symbols: true + on: + branch: /^(main|dev)$/ + - provider: GitHub + auth_token: + secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX + artifact: /Serilog.*\.nupkg/ + tag: v$(appveyor_build_version) + on: + branch: main + \ No newline at end of file diff --git a/serilog-enrichers-environment.sln b/serilog-enrichers-environment.sln index 067362b..015fcea 100644 --- a/serilog-enrichers-environment.sln +++ b/serilog-enrichers-environment.sln @@ -8,9 +8,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}" ProjectSection(SolutionItems) = preProject Build.ps1 = Build.ps1 - NuGet.Config = NuGet.Config README.md = README.md assets\Serilog.snk = assets\Serilog.snk + appveyor.yml = appveyor.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{406006F7-12FA-4A8A-ADC8-80E5338F5275}" diff --git a/src/Serilog.Enrichers.Environment/Enrichers/CachedPropertyEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/CachedPropertyEnricher.cs index 9bc92d5..a0ea129 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/CachedPropertyEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/CachedPropertyEnricher.cs @@ -15,31 +15,28 @@ using Serilog.Core; using Serilog.Events; -namespace Serilog.Enrichers -{ - public abstract class CachedPropertyEnricher: ILogEventEnricher - { - private LogEventProperty? _cachedProperty { get; set; } +namespace Serilog.Enrichers; - /// - /// Enrich the log event. - /// - /// The log event to enrich. - /// Factory for creating new properties to add to the event. - public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) - { - logEvent.AddPropertyIfAbsent(GetLogEventProperty(propertyFactory)); - } +abstract class CachedPropertyEnricher: ILogEventEnricher +{ + LogEventProperty? CachedProperty { get; set; } - private LogEventProperty GetLogEventProperty(ILogEventPropertyFactory propertyFactory) - { - // Don't care about thread-safety, in the worst case the field gets overwritten and one - // property will be GCed - _cachedProperty ??= CreateProperty(propertyFactory); + /// + /// Enrich the log event. + /// + /// The log event to enrich. + /// Factory for creating new properties to add to the event. + public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) + { + logEvent.AddPropertyIfAbsent(GetLogEventProperty(propertyFactory)); + } - return _cachedProperty; - } - - protected abstract LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory); + LogEventProperty GetLogEventProperty(ILogEventPropertyFactory propertyFactory) + { + // Don't care about thread-safety, in the worst case the field gets overwritten and one + // property will be GCed + return CachedProperty ??= CreateProperty(propertyFactory); } + + protected abstract LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory); } diff --git a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs index 9bfd9de..b3c9569 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs @@ -15,37 +15,33 @@ using System; using Serilog.Core; using Serilog.Events; -using System.Runtime.CompilerServices; -namespace Serilog.Enrichers +namespace Serilog.Enrichers; + +/// +/// Enriches log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT environment variable. +/// +class EnvironmentNameEnricher : CachedPropertyEnricher { /// - /// Enriches log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT environment variable. + /// The property name added to enriched log events. /// - public class EnvironmentNameEnricher : CachedPropertyEnricher + const string EnvironmentNamePropertyName = "EnvironmentName"; + + protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) { - /// - /// The property name added to enriched log events. - /// - public const string EnvironmentNamePropertyName = "EnvironmentName"; + var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - // Qualify as uncommon-path - [MethodImpl(MethodImplOptions.NoInlining)] - protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) + if (string.IsNullOrWhiteSpace(environmentName)) { - var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - - if (string.IsNullOrWhiteSpace(environmentName)) - { - environmentName = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT"); - } - - if (string.IsNullOrWhiteSpace(environmentName)) - { - environmentName = "Production"; - } + environmentName = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT"); + } - return propertyFactory.CreateProperty(EnvironmentNamePropertyName, environmentName); + if (string.IsNullOrWhiteSpace(environmentName)) + { + environmentName = "Production"; } + + return propertyFactory.CreateProperty(EnvironmentNamePropertyName, environmentName); } -} +} \ No newline at end of file diff --git a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs index f8a90c7..7eed351 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs @@ -16,30 +16,24 @@ using Serilog.Core; using Serilog.Events; -namespace Serilog.Enrichers +namespace Serilog.Enrichers; + +/// +/// Enriches log events with an EnvironmentUserName property containing [\]. +/// +class EnvironmentUserNameEnricher : CachedPropertyEnricher { /// - /// Enriches log events with an EnvironmentUserName property containing [\]. + /// The property name added to enriched log events. /// - public class EnvironmentUserNameEnricher : CachedPropertyEnricher - { - /// - /// The property name added to enriched log events. - /// - public const string EnvironmentUserNamePropertyName = "EnvironmentUserName"; + const string EnvironmentUserNamePropertyName = "EnvironmentUserName"; - protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) - { -#if ENV_USER_NAME - var userDomainName = Environment.UserDomainName; - var userName = Environment.UserName; -#else - var userDomainName = Environment.GetEnvironmentVariable("USERDOMAIN"); - var userName = Environment.GetEnvironmentVariable("USERNAME"); -#endif - var environmentUserName = !string.IsNullOrWhiteSpace(userDomainName) ? $@"{userDomainName}\{userName}" : userName; + protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) + { + var userDomainName = Environment.UserDomainName; + var userName = Environment.UserName; + var environmentUserName = !string.IsNullOrWhiteSpace(userDomainName) ? $@"{userDomainName}\{userName}" : userName; - return propertyFactory.CreateProperty(EnvironmentUserNamePropertyName, environmentUserName); - } + return propertyFactory.CreateProperty(EnvironmentUserNamePropertyName, environmentUserName); } -} +} \ No newline at end of file diff --git a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs index 092655c..5bac94f 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs @@ -15,35 +15,31 @@ using System; using Serilog.Core; using Serilog.Events; -using System.Runtime.CompilerServices; -namespace Serilog.Enrichers +namespace Serilog.Enrichers; + +/// +/// Enriches log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT environment variable. +/// +class EnvironmentVariableEnricher : CachedPropertyEnricher { + readonly string _envVarName; + /// - /// Enriches log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT environment variable. + /// The property name added to enriched log events. /// - public class EnvironmentVariableEnricher : CachedPropertyEnricher - { - private readonly string _envVarName; - - /// - /// The property name added to enriched log events. - /// - public string EnvironmentVariablePropertyName { get; } + string EnvironmentVariablePropertyName { get; } - public EnvironmentVariableEnricher(string envVarName, string? propertyName) - { - _envVarName = envVarName; - EnvironmentVariablePropertyName = propertyName ?? envVarName; - } + public EnvironmentVariableEnricher(string envVarName, string? propertyName) + { + _envVarName = envVarName; + EnvironmentVariablePropertyName = propertyName ?? envVarName; + } - // Qualify as uncommon-path - [MethodImpl(MethodImplOptions.NoInlining)] - protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) - { - var environmentVariableValue = Environment.GetEnvironmentVariable(_envVarName); + protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) + { + var environmentVariableValue = Environment.GetEnvironmentVariable(_envVarName); - return propertyFactory.CreateProperty(EnvironmentVariablePropertyName, environmentVariableValue); - } + return propertyFactory.CreateProperty(EnvironmentVariablePropertyName, environmentVariableValue); } -} +} \ No newline at end of file diff --git a/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs index a580eda..7cf4a64 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs @@ -15,34 +15,22 @@ using System; using Serilog.Core; using Serilog.Events; -using System.Runtime.CompilerServices; -#if NETSTANDARD1_3 -using System.Net; -#endif +namespace Serilog.Enrichers; -namespace Serilog.Enrichers +/// +/// Enriches log events with a MachineName property containing . +/// +class MachineNameEnricher : CachedPropertyEnricher { /// - /// Enriches log events with a MachineName property containing . + /// The property name added to enriched log events. /// - public class MachineNameEnricher : CachedPropertyEnricher - { - /// - /// The property name added to enriched log events. - /// - public const string MachineNamePropertyName = "MachineName"; + const string MachineNamePropertyName = "MachineName"; - // Qualify as uncommon-path - [MethodImpl(MethodImplOptions.NoInlining)] - protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) - { -#if NETSTANDARD1_3 - var machineName = Dns.GetHostName(); -#else - var machineName = Environment.MachineName; -#endif - return propertyFactory.CreateProperty(MachineNamePropertyName, machineName); - } + protected override LogEventProperty CreateProperty(ILogEventPropertyFactory propertyFactory) + { + var machineName = Environment.MachineName; + return propertyFactory.CreateProperty(MachineNamePropertyName, machineName); } -} +} \ No newline at end of file diff --git a/src/Serilog.Enrichers.Environment/EnvironmentLoggerConfigurationExtensions.cs b/src/Serilog.Enrichers.Environment/EnvironmentLoggerConfigurationExtensions.cs index 55a8e66..06a53bc 100644 --- a/src/Serilog.Enrichers.Environment/EnvironmentLoggerConfigurationExtensions.cs +++ b/src/Serilog.Enrichers.Environment/EnvironmentLoggerConfigurationExtensions.cs @@ -16,65 +16,64 @@ using Serilog.Configuration; using Serilog.Enrichers; -namespace Serilog +namespace Serilog; + +/// +/// Extends to add enrichers for . +/// capabilities. +/// +public static class EnvironmentLoggerConfigurationExtensions { /// - /// Extends to add enrichers for . - /// capabilities. + /// Enrich log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT + /// or DOTNET_ENVIRONMENT environment variable. /// - public static class EnvironmentLoggerConfigurationExtensions + /// Logger enrichment configuration. + /// Configuration object allowing method chaining. + public static LoggerConfiguration WithEnvironmentName( + this LoggerEnrichmentConfiguration enrichmentConfiguration) { - /// - /// Enrich log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT environment variable. - /// - /// Logger enrichment configuration. - /// Configuration object allowing method chaining. - public static LoggerConfiguration WithEnvironmentName( - this LoggerEnrichmentConfiguration enrichmentConfiguration) - { - if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); - return enrichmentConfiguration.With(); - } + if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); + return enrichmentConfiguration.With(); + } - /// - /// Enrich log events with a MachineName property containing the current . - /// - /// Logger enrichment configuration. - /// Configuration object allowing method chaining. - public static LoggerConfiguration WithMachineName( - this LoggerEnrichmentConfiguration enrichmentConfiguration) - { - if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); - return enrichmentConfiguration.With(); - } + /// + /// Enrich log events with a MachineName property containing the current . + /// + /// Logger enrichment configuration. + /// Configuration object allowing method chaining. + public static LoggerConfiguration WithMachineName( + this LoggerEnrichmentConfiguration enrichmentConfiguration) + { + if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); + return enrichmentConfiguration.With(); + } - /// - /// Enriches log events with an EnvironmentUserName property containing [\]. - /// - /// Logger enrichment configuration. - /// Configuration object allowing method chaining. - public static LoggerConfiguration WithEnvironmentUserName( - this LoggerEnrichmentConfiguration enrichmentConfiguration) - { - if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); - return enrichmentConfiguration.With(); - } + /// + /// Enriches log events with an EnvironmentUserName property containing . + /// + /// Logger enrichment configuration. + /// Configuration object allowing method chaining. + public static LoggerConfiguration WithEnvironmentUserName( + this LoggerEnrichmentConfiguration enrichmentConfiguration) + { + if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); + return enrichmentConfiguration.With(); + } - /// - /// Enriches log events with an property containing the value of the specified Environment Variable using - /// [\]. - /// - /// Logger enrichment configuration. - /// The name of the Environment Variable - /// The Optional name of the property. If empty is used - /// Configuration object allowing method chaining. - public static LoggerConfiguration WithEnvironmentVariable( - this LoggerEnrichmentConfiguration enrichmentConfiguration, string environmentVariableName, string? propertyName = null) - { - if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); - var environmentVariableEnricher = new EnvironmentVariableEnricher(environmentVariableName, propertyName); - return enrichmentConfiguration.With(environmentVariableEnricher); - } - + /// + /// Enriches log events with an property containing the value of the specified Environment Variable using + /// . + /// + /// Logger enrichment configuration. + /// The name of the Environment Variable + /// The Optional name of the property. If empty is used + /// Configuration object allowing method chaining. + public static LoggerConfiguration WithEnvironmentVariable( + this LoggerEnrichmentConfiguration enrichmentConfiguration, string environmentVariableName, string? propertyName = null) + { + if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); + var environmentVariableEnricher = new EnvironmentVariableEnricher(environmentVariableName, propertyName); + return enrichmentConfiguration.With(environmentVariableEnricher); } -} +} \ No newline at end of file diff --git a/src/Serilog.Enrichers.Environment/Properties/AssemblyInfo.cs b/src/Serilog.Enrichers.Environment/Properties/AssemblyInfo.cs deleted file mode 100644 index e6a0a37..0000000 --- a/src/Serilog.Enrichers.Environment/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; -using System.Reflection; - -[assembly: AssemblyVersion("2.0.0.0")] - -[assembly: CLSCompliant(true)] diff --git a/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj b/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj index 663fa91..914933a 100644 --- a/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj +++ b/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj @@ -1,41 +1,37 @@ - - Enrich Serilog log events with properties from System.Environment. - 3.0.0 - Serilog Contributors - net45;netstandard1.3;netstandard1.5;netstandard2.0 - Serilog.Enrichers.Environment - ../../assets/Serilog.snk - true - true - Serilog.Enrichers.Environment - serilog;machine;enricher - http://serilog.net/images/serilog-enricher-nuget.png - http://serilog.net - Apache-2.0 - https://github.com/serilog/serilog-enrichers-environment - git - false - latest - enable - - - - - - - - - - - - - - - - - $(DefineConstants);ENV_USER_NAME - - + + Enrich Serilog log events with properties from System.Environment. + 3.0.0 + 3.0.0.0 + Serilog Contributors + + net471;net462 + + $(TargetFrameworks);net8.0;net6.0;netstandard2.0 + serilog;machine;enricher + serilog-enricher-nuget.png + https://github.com/serilog/serilog-enrichers-environment + Apache-2.0 + https://github.com/serilog/serilog-enrichers-environment + git + true + Serilog + README.md + 12 + enable + true + + + + + + + + + + + diff --git a/test/Serilog.Enrichers.Environment.Tests/Serilog.Enrichers.Environment.Tests.csproj b/test/Serilog.Enrichers.Environment.Tests/Serilog.Enrichers.Environment.Tests.csproj index ef9e3c1..a48aa24 100644 --- a/test/Serilog.Enrichers.Environment.Tests/Serilog.Enrichers.Environment.Tests.csproj +++ b/test/Serilog.Enrichers.Environment.Tests/Serilog.Enrichers.Environment.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net46 + net48;net8.0 false @@ -10,9 +10,9 @@ - - - + + + diff --git a/test/Serilog.Enrichers.Environment.Tests/Support/DelegateDisposable.cs b/test/Serilog.Enrichers.Environment.Tests/Support/DelegateDisposable.cs index fbafd38..54bfc69 100644 --- a/test/Serilog.Enrichers.Environment.Tests/Support/DelegateDisposable.cs +++ b/test/Serilog.Enrichers.Environment.Tests/Support/DelegateDisposable.cs @@ -4,8 +4,8 @@ namespace Serilog.Tests.Support { public class DelegateDisposable : IDisposable { - private readonly Action _disposeAction; - private bool _disposed; + readonly Action _disposeAction; + bool _disposed; public DelegateDisposable(Action disposeAction) { From 0a7892ec64e94cfd6825747f075c1e4ac0c2cfbe Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 7 Jun 2024 15:54:08 +1000 Subject: [PATCH 2/4] Update build script --- Build.ps1 | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index d85a1f2..ba41ab1 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -3,8 +3,8 @@ echo "build: Build started" Push-Location $PSScriptRoot if(Test-Path .\artifacts) { - echo "build: Cleaning ./artifacts" - Remove-Item ./artifacts -Force -Recurse + echo "build: Cleaning .\artifacts" + Remove-Item .\artifacts -Force -Recurse } & dotnet restore --no-cache @@ -16,34 +16,33 @@ $commitHash = $(git rev-parse --short HEAD) $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] echo "build: Package version suffix is $suffix" -echo "build: Build version suffix is $buildSuffix" +echo "build: Build version suffix is $buildSuffix" -foreach ($src in gci src/*) { +foreach ($src in ls src/*) { Push-Location $src echo "build: Packaging project in $src" - & dotnet build -c Release --version-suffix=$buildSuffix - - if($suffix) { - & dotnet pack -c Release --include-source --no-build -o ../../artifacts --version-suffix=$suffix + & dotnet build -c Release --version-suffix=$buildSuffix -p:EnableSourceLink=true + if ($suffix) { + & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build } else { - & dotnet pack -c Release --include-source --no-build -o ../../artifacts + & dotnet pack -c Release -o ..\..\artifacts --no-build } - if($LASTEXITCODE -ne 0) { exit 1 } + if($LASTEXITCODE -ne 0) { throw "build failed" } Pop-Location } -foreach ($test in gci test/*.Tests) { +foreach ($test in ls test/*.Tests) { Push-Location $test echo "build: Testing project in $test" & dotnet test -c Release - if($LASTEXITCODE -ne 0) { exit 3 } + if($LASTEXITCODE -ne 0) { throw "tests failed" } Pop-Location } -Pop-Location +Pop-Location \ No newline at end of file From 07a92babab9404bdacb1b6dafadca6c6b2621bfa Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 7 Jun 2024 15:59:09 +1000 Subject: [PATCH 3/4] Package icon --- assets/serilog-enricher-nuget.png | Bin 0 -> 21569 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/serilog-enricher-nuget.png diff --git a/assets/serilog-enricher-nuget.png b/assets/serilog-enricher-nuget.png new file mode 100644 index 0000000000000000000000000000000000000000..0a1173e6bfc2389237ca135e98e3c479296f1e17 GIT binary patch literal 21569 zcmbrmWmJ{h7dN`;?vzwoX-R46Zs`V*?oR0j2^B$7P*6G)k#0mJMLJcG5=6S*xzGQ- zW881|!#!i1p$L0F&wkcibN*_PpslGyfJ=jmKp+TIl;w312o(4$3IZDw{xI_@vxh&> zy=7JOvEjcEY`b{)8plJ~*c*XhmPY=M5;dr61pj!$N5RNP&)wd~-`eXT!r$MY$I;E% z+t%9SA&)J^yuI1sVd{B#6;ZMs-gR;Oz*}=CvOEA zo7kKs->|y-!p8h~;*AzI0Z#gKFVQIBFdN$*Z;oR$^T`Mp=x)R)cAZlojE=!<>|oed?7tTBdW`@2Rqrz@7ciY2ls`pQ}1<_ zI$>T1ESU)_j~kLSgsG|UlGFM})2-fbutR52s1B2AKT^Qc)pufwCkI(V1-M{+U^ntU74+9Hzm}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zF>p(ng=8ZrOCsQJ;150w$Gi=+55`dS5RpN=qRl6Yse4z}BygGIRw4qtkmi zi>U(|q#XIfaJ~WT7_Ls-`t&p4!JRK&m|h#ud@#=O^!8>T@`3>oun=c&Pr{hf`QZeA zYAWg-M>4cZ0AYfOt!(e&lJ-wtd|MS@%+C=!de2pjr)6Ee>f!I7zeicz>jp5A7OO7% ztDH=lmkf0uF)}cqm)tXlGDaLCwPA2iTvnu6fZEx(73q$#9Tf*>maA%L&`~_ul+9Rsl4tt2xw-isAD<_QOIIRS{=ui8C|BUseT155v|@2c zKJE*rQuC~X*NIst?{yYkU9@eX`tboIQjMfWD{kSB*IhTc-%QPWo0@G%OiChr<3MT& zWn%Jq3ZCJ?PdBDg*GT=_fQnDf{R?XPt^Znc{0`K>ZCl(j@uG03&5j$~%nEf-AdS2o zZyIHP@N-GyS9c6FQ93tLC|_kirX$pX?_Rw70@hu^@x*ZEM$i#tc^F9L=jEk04CZuH wjw2IaQdXu}HRJVmOuq1BZK2kk+yv6^#=-aQ|GDUg$9<9*4({|aT43V;0R-0siU0rr literal 0 HcmV?d00001 From 2b97f218a40e4370cfc8d1cb6e2772d024b4d790 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Sat, 8 Jun 2024 07:24:27 +1000 Subject: [PATCH 4/4] Seal internal classes; publish snupkgs --- Build.ps1 | 4 +-- appveyor.yml | 33 ++++++++++--------- .../Enrichers/EnvironmentNameEnricher.cs | 2 +- .../Enrichers/EnvironmentUserNameEnricher.cs | 2 +- .../Enrichers/EnvironmentVariableEnricher.cs | 2 +- .../Enrichers/MachineNameEnricher.cs | 2 +- .../Serilog.Enrichers.Environment.csproj | 1 + 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index ba41ab1..7886e8f 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -23,13 +23,13 @@ foreach ($src in ls src/*) { echo "build: Packaging project in $src" - & dotnet build -c Release --version-suffix=$buildSuffix -p:EnableSourceLink=true + & dotnet build -c Release --version-suffix=$buildSuffix -p:ContinuousIntegrationBuild=true if ($suffix) { & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build } else { & dotnet pack -c Release -o ..\..\artifacts --no-build } - if($LASTEXITCODE -ne 0) { throw "build failed" } + if($LASTEXITCODE -ne 0) { throw "build failed" } Pop-Location } diff --git a/appveyor.yml b/appveyor.yml index 81bd95e..d367cf6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,22 +2,25 @@ version: '{build}' skip_tags: true image: Visual Studio 2022 build_script: - - pwsh: ./Build.ps1 + - pwsh: ./Build.ps1 test: off artifacts: - - path: artifacts/Serilog.*.nupkg + - path: artifacts/Serilog.*.nupkg + - path: artifacts/Serilog.*.snupkg deploy: - - provider: NuGet - api_key: - secure: Fh92tRIFbe1FAiyD8lTThWgAorQ1vV+eFYMlUK0iLHBBenJcy/UYc1qj6kgHvUcO - skip_symbols: true - on: - branch: /^(main|dev)$/ - - provider: GitHub - auth_token: - secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX - artifact: /Serilog.*\.nupkg/ - tag: v$(appveyor_build_version) - on: - branch: main + - provider: NuGet + api_key: + secure: Fh92tRIFbe1FAiyD8lTThWgAorQ1vV+eFYMlUK0iLHBBenJcy/UYc1qj6kgHvUcO + skip_symbols: true + on: + branch: /^(main|dev)$/ + - provider: GitHub + auth_token: + secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX + artifacts: + /Serilog.*\.nupkg/ + /Serilog.*\.snupkg/ + tag: v$(appveyor_build_version) + on: + branch: main \ No newline at end of file diff --git a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs index b3c9569..82c68b2 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentNameEnricher.cs @@ -21,7 +21,7 @@ namespace Serilog.Enrichers; ///

/// Enriches log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT environment variable. /// -class EnvironmentNameEnricher : CachedPropertyEnricher +sealed class EnvironmentNameEnricher : CachedPropertyEnricher { /// /// The property name added to enriched log events. diff --git a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs index 7eed351..a1b9675 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentUserNameEnricher.cs @@ -21,7 +21,7 @@ namespace Serilog.Enrichers; /// /// Enriches log events with an EnvironmentUserName property containing [\]. /// -class EnvironmentUserNameEnricher : CachedPropertyEnricher +sealed class EnvironmentUserNameEnricher : CachedPropertyEnricher { /// /// The property name added to enriched log events. diff --git a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs index 5bac94f..0ca0912 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/EnvironmentVariableEnricher.cs @@ -21,7 +21,7 @@ namespace Serilog.Enrichers; /// /// Enriches log events with a EnvironmentName property containing the value of the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT environment variable. /// -class EnvironmentVariableEnricher : CachedPropertyEnricher +sealed class EnvironmentVariableEnricher : CachedPropertyEnricher { readonly string _envVarName; diff --git a/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs b/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs index 7cf4a64..55ff49e 100644 --- a/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs +++ b/src/Serilog.Enrichers.Environment/Enrichers/MachineNameEnricher.cs @@ -21,7 +21,7 @@ namespace Serilog.Enrichers; /// /// Enriches log events with a MachineName property containing . /// -class MachineNameEnricher : CachedPropertyEnricher +sealed class MachineNameEnricher : CachedPropertyEnricher { /// /// The property name added to enriched log events. diff --git a/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj b/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj index 914933a..ab003f8 100644 --- a/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj +++ b/src/Serilog.Enrichers.Environment/Serilog.Enrichers.Environment.csproj @@ -28,6 +28,7 @@ +