Skip to content

Commit 616d521

Browse files
authored
Merge pull request #7 from serilog/dev
3.0.0 Release
2 parents 9795c5c + f9f7eb0 commit 616d521

File tree

7 files changed

+45
-23
lines changed

7 files changed

+45
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,4 @@ _Pvt_Extensions
234234

235235
# FAKE - F# Make
236236
.fake/
237+
*.orig

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

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
# Serilog.Enrichers.Thread
1+
# 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/)
22

33
Enrich Serilog events with properties from the current thread.
44

5-
[![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/)
5+
### Getting started
6+
7+
Install the package from NuGet:
8+
9+
```powershell
10+
Install-Package Serilog.Enrichers.Thread
11+
```
12+
13+
In your logger configuration, apply `Enrich.WithThreadId()`:
14+
15+
```csharp
16+
Log.Logger = new LoggerConfiguration()
17+
.Enrich.WithThreadId()
18+
.CreateLogger();
19+
```
620

721
To use the enricher, first install the NuGet package:
822

923
```powershell
1024
Install-Package Serilog.Enrichers.Thread
1125
```
1226

13-
* [Documentation](https://github.com/serilog/serilog/wiki)
1427

1528
Copyright © 2016 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html).

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ deploy:
1919
secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
2020
skip_symbols: true
2121
on:
22-
branch: /^(master)$/
22+
branch: /^(master|dev)$/
2323
- provider: GitHub
2424
auth_token:
25-
secure: ggZTqqV1z0xecDoQbeoy3A7xikShCt9FWZIGp95dG9Fo0p5RAT9oGU0ZekHfUIwk
25+
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
2626
artifact: /Serilog.*\.nupkg/
2727
tag: v$(appveyor_build_version)
2828
on:

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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.0.0",
2+
"version": "3.0.0-*",
33
"description": "Enrich Serilog events with properties from the current thread.",
44
"authors": [ "Serilog Contributors" ],
55
"packOptions": {
@@ -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"
2524
}
2625
}
2726
}

0 commit comments

Comments
 (0)