diff --git a/Build.ps1 b/Build.ps1
index 0515652..7c5a85f 100644
--- a/Build.ps1
+++ b/Build.ps1
@@ -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
diff --git a/README.md b/README.md
index 4ab8bae..b3fd24d 100644
--- a/README.md
+++ b/README.md
@@ -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()
@@ -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)._
diff --git a/Serilog.Sinks.Trace.sln b/serilog-sinks-trace.sln
similarity index 91%
rename from Serilog.Sinks.Trace.sln
rename to serilog-sinks-trace.sln
index 42bedc3..21554ed 100644
--- a/Serilog.Sinks.Trace.sln
+++ b/serilog-sinks-trace.sln
@@ -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
@@ -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
diff --git a/src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs b/src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs
index a3e9932..5b6affd 100644
--- a/src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs
+++ b/src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs
@@ -19,6 +19,8 @@
using Serilog.Events;
using Serilog.Formatting.Display;
using Serilog.Sinks.DiagnosticTrace;
+using Serilog.Formatting;
+using Serilog.Formatting.Json;
namespace Serilog
{
@@ -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);
+ }
+
+ ///
+ /// Write log events to the .
+ ///
+ /// Logger sink configuration.
+ /// The minimum level for
+ /// events passed through the sink. Ignored when is specified.
+ /// A switch allowing the pass-through minimum level
+ /// to be changed at runtime.
+ /// A custom formatter to apply to the output events. This can be used with
+ /// e.g. to produce JSON output. To customize the text layout only, use the
+ /// overload that accepts an output template instead.
+ /// Configuration object allowing method chaining.
+ 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);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Serilog.Sinks.Trace/project.json b/src/Serilog.Sinks.Trace/project.json
index f79fb9e..6f9e51b 100644
--- a/src/Serilog.Sinks.Trace/project.json
+++ b/src/Serilog.Sinks.Trace/project.json
@@ -1,5 +1,5 @@
{
- "version": "2.0.0-*",
+ "version": "2.1.0-*",
"description": "The diagnostic trace sink for Serilog.",
"authors": [
"Serilog Contributors"
@@ -30,4 +30,4 @@
}
}
}
-}
\ No newline at end of file
+}