From ef4daf69331ad5d718e88eccf7c89099188d0ffc Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 28 Jun 2016 20:14:16 +1000 Subject: [PATCH 1/6] New deployment token CC @merbla --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index da6effa..9458341 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ artifacts: deploy: - provider: NuGet api_key: - secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x + secure: ggZTqqV1z0xecDoQbeoy3A7xikShCt9FWZIGp95dG9Fo0p5RAT9oGU0ZekHfUIwk skip_symbols: true on: branch: /^(dev|master)$/ From 8911305193d4207db6cceef460e785ae592b3359 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Thu, 11 Aug 2016 11:24:02 +1000 Subject: [PATCH 2/6] Add basic usage to README.md [Skip CI] --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cf0c5d4..f25948a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,22 @@ -# Serilog.Enrichers.Thread +# Serilog.Enrichers.Thread [![Build status](https://ci.appveyor.com/api/projects/status/2vgxdy3swg6eaj3f?svg=true)](https://ci.appveyor.com/project/serilog/serilog-enrichers-thread) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Enrichers.Thread.svg?style=flat)](https://www.nuget.org/packages/Serilog.Enrichers.Thread/) Enrich Serilog events with properties from the current thread. -[![Build status](https://ci.appveyor.com/api/projects/status/2vgxdy3swg6eaj3f?svg=true)](https://ci.appveyor.com/project/serilog/serilog-enrichers-thread) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Enrichers.Thread.svg?style=flat)](https://www.nuget.org/packages/Serilog.Enrichers.Thread/) +### Getting started + +Install the package from NuGet: + +```powershell +Install-Package Serilog.Enrichers.Thread +``` + +In your logger configuration, apply `Enrich.WithThreadId()`: + +```csharp +Log.Logger = new LoggerConfiguration() + .Enrich.WithThreadId() + .CreateLogger(); +``` -* [Documentation](https://github.com/serilog/serilog/wiki) Copyright © 2016 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html). From e8c32f77ebeed3d35265a11a3256835170f42f7b Mon Sep 17 00:00:00 2001 From: Sergey Komisarchik Date: Fri, 11 Nov 2016 10:49:27 +0300 Subject: [PATCH 3/6] 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 4/6] 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 5/6] 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 From f9f7eb0b83a49ae05f485b389214d991d89d694d Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 11 Nov 2016 18:46:47 +1000 Subject: [PATCH 6/6] Version bump --- src/Serilog.Enrichers.Thread/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serilog.Enrichers.Thread/project.json b/src/Serilog.Enrichers.Thread/project.json index d05becb..2bb9bd1 100644 --- a/src/Serilog.Enrichers.Thread/project.json +++ b/src/Serilog.Enrichers.Thread/project.json @@ -1,5 +1,5 @@ { - "version": "2.0.1-*", + "version": "3.0.0-*", "description": "Enrich Serilog events with properties from the current thread.", "authors": [ "Serilog Contributors" ], "packOptions": {