Skip to content

Commit 918499e

Browse files
authored
Merge pull request #6 from skomis-mm/dev
Remove System.Threading.Thread dependency, add netstandard1.0 support.
2 parents 8911305 + 9b99f22 commit 918499e

File tree

5 files changed

+39
-24
lines changed

5 files changed

+39
-24
lines changed

Build.ps1

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1+
echo "build: Build started"
2+
13
Push-Location $PSScriptRoot
24

3-
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
5+
if(Test-Path .\artifacts) {
6+
echo "build: Cleaning .\artifacts"
7+
Remove-Item .\artifacts -Force -Recurse
8+
}
49

5-
& dotnet restore
10+
& dotnet restore --no-cache
611

7-
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
12+
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
13+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
14+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
815

9-
Push-Location src/Serilog.Enrichers.Thread
16+
echo "build: Version suffix is $suffix"
1017

11-
& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision
12-
if($LASTEXITCODE -ne 0) { exit 1 }
18+
foreach ($src in ls src/*) {
19+
Push-Location $src
1320

14-
Pop-Location
15-
# Push-Location test/Serilog.Enrichers.Thread.Tests
21+
echo "build: Packaging project in $src"
22+
23+
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
24+
if($LASTEXITCODE -ne 0) { exit 1 }
1625

17-
# & dotnet test -c Release
18-
# if($LASTEXITCODE -ne 0) { exit 2 }
26+
Pop-Location
27+
}
1928

20-
# Pop-Location
2129
Pop-Location

appveyor.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
version: '{build}'
2+
skip_tags: true
23
image: Visual Studio 2015
34
configuration: Release
45
install:
56
- ps: mkdir -Force ".\build\" | Out-Null
6-
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
7+
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
78
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
8-
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-002823'
9+
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-003121'
910
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
1011
build_script:
1112
- ps: ./Build.ps1
@@ -15,8 +16,14 @@ artifacts:
1516
deploy:
1617
- provider: NuGet
1718
api_key:
18-
secure: ggZTqqV1z0xecDoQbeoy3A7xikShCt9FWZIGp95dG9Fo0p5RAT9oGU0ZekHfUIwk
19+
secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
1920
skip_symbols: true
2021
on:
21-
branch: /^(dev|master)$/
22-
22+
branch: /^(master|dev)$/
23+
- provider: GitHub
24+
auth_token:
25+
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
26+
artifact: /Serilog.*\.nupkg/
27+
tag: v$(appveyor_build_version)
28+
on:
29+
branch: master

src/Serilog.Enrichers.Thread/Enrichers/ThreadIdEnricher.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
using System.Threading;
1616
using Serilog.Core;
1717
using Serilog.Events;
18+
using System;
1819

1920
namespace Serilog.Enrichers
2021
{
2122
/// <summary>
22-
/// Enriches log events with a ThreadId property containing the current <see cref="Thread.ManagedThreadId"/>.
23+
/// Enriches log events with a ThreadId property containing the <see cref="Environment.CurrentManagedThreadId"/>.
2324
/// </summary>
2425
public class ThreadIdEnricher : ILogEventEnricher
2526
{
@@ -35,7 +36,7 @@ public class ThreadIdEnricher : ILogEventEnricher
3536
/// <param name="propertyFactory">Factory for creating new properties to add to the event.</param>
3637
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
3738
{
38-
logEvent.AddPropertyIfAbsent(new LogEventProperty(ThreadIdPropertyName, new ScalarValue(Thread.CurrentThread.ManagedThreadId)));
39+
logEvent.AddPropertyIfAbsent(new LogEventProperty(ThreadIdPropertyName, new ScalarValue(Environment.CurrentManagedThreadId)));
3940
}
4041
}
4142
}

src/Serilog.Enrichers.Thread/ThreadLoggerConfigurationExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
namespace Serilog
2222
{
2323
/// <summary>
24-
/// Extends <see cref="LoggerConfiguration"/> to add enrichers for <see cref="Thread"/>.
24+
/// Extends <see cref="LoggerConfiguration"/> to add enrichers for <see cref="Environment.CurrentManagedThreadId"/>.
2525
/// capabilities.
2626
/// </summary>
2727
public static class ThreadLoggerConfigurationExtensions
2828
{
2929
/// <summary>
30-
/// Enrich log events with a ThreadId property containing the current <see cref="Thread.ManagedThreadId"/>.
30+
/// Enrich log events with a ThreadId property containing the <see cref="Environment.CurrentManagedThreadId"/>.
3131
/// </summary>
3232
/// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
3333
/// <returns>Configuration object allowing method chaining.</returns>

src/Serilog.Enrichers.Thread/project.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.0.0-rc-*",
2+
"version": "2.0.1-*",
33
"description": "Enrich Serilog events with properties from the current thread.",
44
"authors": [ "Serilog Contributors" ],
55
"packOptions": {
@@ -9,7 +9,7 @@
99
"iconUrl": "http://serilog.net/images/serilog-enricher-nuget.png"
1010
},
1111
"dependencies": {
12-
"Serilog": "2.0.0-rc-577"
12+
"Serilog": "2.0.0"
1313
},
1414
"buildOptions": {
1515
"keyFile": "../../assets/Serilog.snk",
@@ -19,9 +19,8 @@
1919
"frameworks": {
2020
"net4.5": {
2121
},
22-
"netstandard1.3": {
22+
"netstandard1.0": {
2323
"dependencies": {
24-
"System.Threading.Thread": "4.0.0-rc2-24027"
2524
}
2625
}
2726
}

0 commit comments

Comments
 (0)