From e8c32f77ebeed3d35265a11a3256835170f42f7b Mon Sep 17 00:00:00 2001 From: Sergey Komisarchik Date: Fri, 11 Nov 2016 10:49:27 +0300 Subject: [PATCH 1/3] remove Thread dependency and add compat up to netstandard1.0 --- src/Serilog.Enrichers.Thread/Enrichers/ThreadIdEnricher.cs | 5 +++-- .../ThreadLoggerConfigurationExtensions.cs | 4 ++-- src/Serilog.Enrichers.Thread/project.json | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Serilog.Enrichers.Thread/Enrichers/ThreadIdEnricher.cs b/src/Serilog.Enrichers.Thread/Enrichers/ThreadIdEnricher.cs index f588f90..efaf6fa 100644 --- a/src/Serilog.Enrichers.Thread/Enrichers/ThreadIdEnricher.cs +++ b/src/Serilog.Enrichers.Thread/Enrichers/ThreadIdEnricher.cs @@ -15,11 +15,12 @@ using System.Threading; using Serilog.Core; using Serilog.Events; +using System; namespace Serilog.Enrichers { /// - /// Enriches log events with a ThreadId property containing the current . + /// Enriches log events with a ThreadId property containing the . /// public class ThreadIdEnricher : ILogEventEnricher { @@ -35,7 +36,7 @@ public class ThreadIdEnricher : ILogEventEnricher /// Factory for creating new properties to add to the event. public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) { - logEvent.AddPropertyIfAbsent(new LogEventProperty(ThreadIdPropertyName, new ScalarValue(Thread.CurrentThread.ManagedThreadId))); + logEvent.AddPropertyIfAbsent(new LogEventProperty(ThreadIdPropertyName, new ScalarValue(Environment.CurrentManagedThreadId))); } } } diff --git a/src/Serilog.Enrichers.Thread/ThreadLoggerConfigurationExtensions.cs b/src/Serilog.Enrichers.Thread/ThreadLoggerConfigurationExtensions.cs index e24e9b6..6ee3f34 100644 --- a/src/Serilog.Enrichers.Thread/ThreadLoggerConfigurationExtensions.cs +++ b/src/Serilog.Enrichers.Thread/ThreadLoggerConfigurationExtensions.cs @@ -21,13 +21,13 @@ namespace Serilog { /// - /// Extends to add enrichers for . + /// Extends to add enrichers for . /// capabilities. /// public static class ThreadLoggerConfigurationExtensions { /// - /// Enrich log events with a ThreadId property containing the current . + /// Enrich log events with a ThreadId property containing the . /// /// Logger enrichment configuration. /// Configuration object allowing method chaining. diff --git a/src/Serilog.Enrichers.Thread/project.json b/src/Serilog.Enrichers.Thread/project.json index 0e1d750..d05becb 100644 --- a/src/Serilog.Enrichers.Thread/project.json +++ b/src/Serilog.Enrichers.Thread/project.json @@ -1,5 +1,5 @@ { - "version": "2.0.0-rc-*", + "version": "2.0.1-*", "description": "Enrich Serilog events with properties from the current thread.", "authors": [ "Serilog Contributors" ], "packOptions": { @@ -9,7 +9,7 @@ "iconUrl": "http://serilog.net/images/serilog-enricher-nuget.png" }, "dependencies": { - "Serilog": "2.0.0-rc-577" + "Serilog": "2.0.0" }, "buildOptions": { "keyFile": "../../assets/Serilog.snk", @@ -19,9 +19,8 @@ "frameworks": { "net4.5": { }, - "netstandard1.3": { + "netstandard1.0": { "dependencies": { - "System.Threading.Thread": "4.0.0-rc2-24027" } } } From 5f28d53abfae68235b3fd39d174f183242e1b1fc Mon Sep 17 00:00:00 2001 From: Sergey Komisarchik Date: Fri, 11 Nov 2016 10:50:22 +0300 Subject: [PATCH 2/3] update build scripts to align with other repos --- Build.ps1 | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 58aa101..b13c813 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -1,21 +1,29 @@ +echo "build: Build started" + Push-Location $PSScriptRoot -if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse } +if(Test-Path .\artifacts) { + echo "build: Cleaning .\artifacts" + Remove-Item .\artifacts -Force -Recurse +} -& dotnet restore +& dotnet restore --no-cache -$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; +$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; +$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; +$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] -Push-Location src/Serilog.Enrichers.Thread +echo "build: Version suffix is $suffix" -& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision -if($LASTEXITCODE -ne 0) { exit 1 } +foreach ($src in ls src/*) { + Push-Location $src -Pop-Location -# Push-Location test/Serilog.Enrichers.Thread.Tests + echo "build: Packaging project in $src" + + & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix + if($LASTEXITCODE -ne 0) { exit 1 } -# & dotnet test -c Release -# if($LASTEXITCODE -ne 0) { exit 2 } + Pop-Location +} -# Pop-Location Pop-Location From 9b99f220718fb9ab59798773621f4596736dd47d Mon Sep 17 00:00:00 2001 From: Sergey Komisarchik Date: Fri, 11 Nov 2016 11:20:05 +0300 Subject: [PATCH 3/3] fix CI failing --- appveyor.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9458341..19d0d28 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,12 @@ version: '{build}' +skip_tags: true image: Visual Studio 2015 configuration: Release install: - ps: mkdir -Force ".\build\" | Out-Null - - ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1" + - ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1" - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli" - - ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-002823' + - ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-003121' - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path" build_script: - ps: ./Build.ps1 @@ -15,8 +16,14 @@ artifacts: deploy: - provider: NuGet api_key: - secure: ggZTqqV1z0xecDoQbeoy3A7xikShCt9FWZIGp95dG9Fo0p5RAT9oGU0ZekHfUIwk + secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x skip_symbols: true on: - branch: /^(dev|master)$/ - + branch: /^(master|dev)$/ +- provider: GitHub + auth_token: + secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX + artifact: /Serilog.*\.nupkg/ + tag: v$(appveyor_build_version) + on: + branch: master