Skip to content

Commit

Permalink
Merge pull request #6 from serilog/dev
Browse files Browse the repository at this point in the history
2.1.0 Release
  • Loading branch information
nblumhardt authored Oct 30, 2016
2 parents f17b0b6 + 26e5934 commit 5774b16
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 20 deletions.
34 changes: 28 additions & 6 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,51 @@
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 --no-cache

$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-$revision"}[$branch -eq "master" -and $revision -ne "local"]
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]

foreach ($src in ls src/Serilog.*) {
echo "build: Version suffix is $suffix"

foreach ($src in ls src/*) {
Push-Location $src

& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$suffix
echo "build: Packaging project in $src"

& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
if($LASTEXITCODE -ne 0) { exit 1 }

Pop-Location
}

foreach ($test in ls test/Serilog.*.Tests) {
foreach ($test in ls test/*.PerformanceTests) {
Push-Location $test

& dotnet test -c Release
echo "build: Building performance test project in $test"

& dotnet build -c Release
if($LASTEXITCODE -ne 0) { exit 2 }

Pop-Location
}

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 }

Pop-Location
}

Pop-Location
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Serilog.Sinks.Trace
# Serilog.Sinks.Trace [![Build status](https://ci.appveyor.com/api/projects/status/v1oe03lx3wymyy7j/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-trace/branch/master) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.Trace.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.Trace/)

The diagnostic trace sink for Serilog.

[![Build status](https://ci.appveyor.com/api/projects/status/v1oe03lx3wymyy7j/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-trace/branch/master) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.Trace.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.Trace/)

Writes log events to the `System.Diagnostics.Trace`.
Writes [Serilog](https://serilog.net) events to `System.Diagnostics.Trace`.

```csharp
var log = new LoggerConfiguration()
Expand All @@ -14,4 +10,4 @@ var log = new LoggerConfiguration()

* [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).
_Copyright © 2016 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html)._
13 changes: 9 additions & 4 deletions Serilog.Sinks.Trace.sln → serilog-sinks-trace.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{037440DE-440
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}"
ProjectSection(SolutionItems) = preProject
Build.ps1 = Build.ps1
global.json = global.json
NuGet.Config = NuGet.Config
README.md = README.md
assets\Serilog.snk = assets\Serilog.snk
EndProjectSection
EndProject
Expand All @@ -20,6 +16,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5C546512-0
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.Trace.Tests", "test\Serilog.Sinks.Trace.Tests\Serilog.Sinks.Trace.Tests.xproj", "{1D56534C-4009-42C2-A573-789CAE6B8AA9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{EF92FCAF-D99B-43B1-98AA-6ABE30E3AD7E}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
global.json = global.json
NuGet.Config = NuGet.Config
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
27 changes: 26 additions & 1 deletion src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
using Serilog.Events;
using Serilog.Formatting.Display;
using Serilog.Sinks.DiagnosticTrace;
using Serilog.Formatting;
using Serilog.Formatting.Json;

namespace Serilog
{
Expand Down Expand Up @@ -51,7 +53,30 @@ public static LoggerConfiguration Trace(
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration));
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate));
var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider);
return Trace(sinkConfiguration, formatter, restrictedToMinimumLevel, levelSwitch);
}

/// <summary>
/// Write log events to the <see cref="System.Diagnostics.Trace"/>.
/// </summary>
/// <param name="sinkConfiguration">Logger sink configuration.</param>
/// <param name="restrictedToMinimumLevel">The minimum level for
/// events passed through the sink. Ignored when <paramref name="levelSwitch"/> is specified.</param>
/// <param name="levelSwitch">A switch allowing the pass-through minimum level
/// to be changed at runtime.</param>
/// <param name="formatter">A custom formatter to apply to the output events. This can be used with
/// e.g. <see cref="JsonFormatter"/> to produce JSON output. To customize the text layout only, use the
/// overload that accepts an output template instead.</param>
/// <returns>Configuration object allowing method chaining.</returns>
public static LoggerConfiguration Trace(
this LoggerSinkConfiguration sinkConfiguration,
ITextFormatter formatter,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
LoggingLevelSwitch levelSwitch = null)
{
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration));
if (formatter == null) throw new ArgumentNullException(nameof(formatter));
return sinkConfiguration.Sink(new TraceSink(formatter), restrictedToMinimumLevel, levelSwitch);
}
}
}
}
4 changes: 2 additions & 2 deletions src/Serilog.Sinks.Trace/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.0-*",
"version": "2.1.0-*",
"description": "The diagnostic trace sink for Serilog.",
"authors": [
"Serilog Contributors"
Expand Down Expand Up @@ -30,4 +30,4 @@
}
}
}
}
}

0 comments on commit 5774b16

Please sign in to comment.