diff --git a/.gitignore b/.gitignore
index 8ff53697f..bcaad9494 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ bld/
[Bb]in/
[Oo]bj/
BenchmarkDotNet.Artifacts/
+.dotnetcli/
# Visual Studio 2015 cache/options directory
.vs/
diff --git a/.travis.yml b/.travis.yml
index 562d018d5..3f7297646 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,10 +5,11 @@ matrix:
- os: linux # Ubuntu 14.04
dist: trusty
sudo: required
- dotnet: 1.0.0-preview2-003121
- - os: osx # OSX 10.11
- osx_image: xcode7.2
- dotnet: 1.0.0-preview2-003121
+ dotnet: 1.0.4
+ # Disabled temporarily due to Travis OSX issues
+ # - os: osx # OSX 10.11
+ # osx_image: xcode7.3
+ # dotnet: 1.0.1
script:
- ./build.sh
\ No newline at end of file
diff --git a/Build.ps1 b/Build.ps1
index 55db40f54..648b06823 100644
--- a/Build.ps1
+++ b/Build.ps1
@@ -24,30 +24,30 @@ foreach ($src in ls src/*) {
echo "build: Packaging project in $src"
& dotnet build -c Release --version-suffix=$buildSuffix
- & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build
+ & dotnet pack -c Release --include-symbols -o ..\..\artifacts --version-suffix=$suffix --no-build
if($LASTEXITCODE -ne 0) { exit 1 }
Pop-Location
}
-foreach ($test in ls test/*.PerformanceTests) {
+foreach ($test in ls test/*.Tests) {
Push-Location $test
- echo "build: Building performance test project in $test"
+ echo "build: Testing project in $test"
- & dotnet build -c Release
- if($LASTEXITCODE -ne 0) { exit 2 }
+ & dotnet test -c Release
+ if($LASTEXITCODE -ne 0) { exit 3 }
Pop-Location
}
-foreach ($test in ls test/*.Tests) {
+foreach ($test in ls test/*.PerformanceTests) {
Push-Location $test
- echo "build: Testing project in $test"
+ echo "build: Building performance test project in $test"
- & dotnet test -c Release
- if($LASTEXITCODE -ne 0) { exit 3 }
+ & dotnet build -c Release
+ if($LASTEXITCODE -ne 0) { exit 2 }
Pop-Location
}
diff --git a/CHANGES.md b/CHANGES.md
index 26b75dfd7..896534e27 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,14 @@
+2.4.0
+* #866 and #877- additional event payload limiting controls
+* #833 - improve performance of message template cache lookup
+* #885 - fix JSON formatting of `NaN` and infinity values
+* #888 - allow minimum level overrides to be specified by configuration providers like _Serilog.Settings.AppSettings_
+* #903 - add further `Log` static methods to match `ILogger` methods
+* #907 - properly dispose audit sinks
+* #913 - include commit hash in `AssemblyInformationalVersion`
+* #925 - allow configuration providers to specify `filter` directives
+* Build and test coverage work in #821, #824, #896.
+
2.3.0
* #870 - fix dispose for level-restricted sinks
* #852 - fix dictionary capturing when key/value are anonymous types
diff --git a/README.md b/README.md
index 8db74f24a..71d8a07d1 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-#Serilog [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/master) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.svg?style=flat)](https://www.nuget.org/packages/Serilog/) [![Rager Releases](http://rager.io/badge.svg?url=https%3A%2F%2Fwww.nuget.org%2Fpackages%2FSerilog%2F)](http://rager.io/projects/search?badge=1&query=nuget.org/packages/Serilog/) [![Join the chat at https://gitter.im/serilog/serilog](https://img.shields.io/gitter/room/serilog/serilog.svg)](https://gitter.im/serilog/serilog) [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-serilog-orange.svg)](http://stackoverflow.com/questions/tagged/serilog)
+# Serilog [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/master) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.svg?style=flat)](https://www.nuget.org/packages/Serilog/) [![Rager Releases](http://rager.io/badge.svg?url=https%3A%2F%2Fwww.nuget.org%2Fpackages%2FSerilog%2F)](http://rager.io/projects/search?badge=1&query=nuget.org/packages/Serilog/) [![Join the chat at https://gitter.im/serilog/serilog](https://img.shields.io/gitter/room/serilog/serilog.svg)](https://gitter.im/serilog/serilog) [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-serilog-orange.svg)](http://stackoverflow.com/questions/tagged/serilog)
Serilog is a diagnostic logging library for .NET applications. It is easy to set up, has a clean API, and runs on all recent .NET platforms. While it's useful even in the simplest applications, Serilog's support for structured logging shines when instrumenting complex, distributed, and asynchronous applications and systems.
@@ -107,4 +107,4 @@ Branch | AppVeyor | Travis
dev | [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/dev?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/dev) | [![Build Status](https://travis-ci.org/serilog/serilog.svg?branch=dev)](https://travis-ci.org/serilog/serilog)
master | [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/master) | [![Build Status](https://travis-ci.org/serilog/serilog.svg?branch=master)](https://travis-ci.org/serilog/serilog)
-_Serilog is copyright © 2013-2016 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html). Needle and thread logo a derivative of work by [Kenneth Appiah](http://www.kensets.com/)._
+_Serilog is copyright © 2013-2017 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html). Needle and thread logo a derivative of work by [Kenneth Appiah](http://www.kensets.com/)._
diff --git a/Serilog.sln b/Serilog.sln
index 32d2b0d9b..be7104f64 100644
--- a/Serilog.sln
+++ b/Serilog.sln
@@ -1,15 +1,11 @@
-
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{037440DE-440B-4129-9F7A-09B42D00397E}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0D135C0C-A60B-454A-A2F4-CD74A30E04B0}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
+ .travis.yml = .travis.yml
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
build.sh = build.sh
@@ -22,44 +18,84 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5
assets\Serilog.snk = assets\Serilog.snk
EndProjectSection
EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog", "src\Serilog\Serilog.xproj", "{803CD13A-D54B-4CEC-A55F-E22AE3D93B3C}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{791D4267-0D6F-4FDF-80F2-11F4E793B0F2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog", "src\Serilog\Serilog.csproj", "{AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{290A2775-7CA0-4F81-9DDC-32E28C3A7565}"
EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Tests", "test\Serilog.Tests\Serilog.Tests.xproj", "{3C2D8E01-5580-426A-BDD9-EC59CD98E618}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDummies", "test\TestDummies\TestDummies.csproj", "{37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}"
EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestDummies", "test\TestDummies\TestDummies.xproj", "{2BB12CE5-C867-43BD-AE5D-253FE3248C7F}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Tests", "test\Serilog.Tests\Serilog.Tests.csproj", "{B11B911D-977A-42CE-900A-596CF59F6FFA}"
EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.PerformanceTests", "test\Serilog.PerformanceTests\Serilog.PerformanceTests.xproj", "{D7A37F73-BBA3-4DAE-9648-1A753A86F968}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.PerformanceTests", "test\Serilog.PerformanceTests\Serilog.PerformanceTests.csproj", "{B4AC7ED9-517B-47E9-BB49-15F8A8478E62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {803CD13A-D54B-4CEC-A55F-E22AE3D93B3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {803CD13A-D54B-4CEC-A55F-E22AE3D93B3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {803CD13A-D54B-4CEC-A55F-E22AE3D93B3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {803CD13A-D54B-4CEC-A55F-E22AE3D93B3C}.Release|Any CPU.Build.0 = Release|Any CPU
- {3C2D8E01-5580-426A-BDD9-EC59CD98E618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3C2D8E01-5580-426A-BDD9-EC59CD98E618}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3C2D8E01-5580-426A-BDD9-EC59CD98E618}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3C2D8E01-5580-426A-BDD9-EC59CD98E618}.Release|Any CPU.Build.0 = Release|Any CPU
- {2BB12CE5-C867-43BD-AE5D-253FE3248C7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2BB12CE5-C867-43BD-AE5D-253FE3248C7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2BB12CE5-C867-43BD-AE5D-253FE3248C7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2BB12CE5-C867-43BD-AE5D-253FE3248C7F}.Release|Any CPU.Build.0 = Release|Any CPU
- {D7A37F73-BBA3-4DAE-9648-1A753A86F968}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D7A37F73-BBA3-4DAE-9648-1A753A86F968}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D7A37F73-BBA3-4DAE-9648-1A753A86F968}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D7A37F73-BBA3-4DAE-9648-1A753A86F968}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Debug|x64.Build.0 = Debug|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Debug|x86.Build.0 = Debug|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Release|x64.ActiveCfg = Release|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Release|x64.Build.0 = Release|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Release|x86.ActiveCfg = Release|Any CPU
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1}.Release|x86.Build.0 = Release|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Debug|x64.Build.0 = Debug|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Debug|x86.Build.0 = Debug|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Release|x64.ActiveCfg = Release|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Release|x64.Build.0 = Release|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Release|x86.ActiveCfg = Release|Any CPU
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF}.Release|x86.Build.0 = Release|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Debug|x64.Build.0 = Debug|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Debug|x86.Build.0 = Debug|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Release|x64.ActiveCfg = Release|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Release|x64.Build.0 = Release|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Release|x86.ActiveCfg = Release|Any CPU
+ {B11B911D-977A-42CE-900A-596CF59F6FFA}.Release|x86.Build.0 = Release|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Debug|x64.Build.0 = Debug|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Debug|x86.Build.0 = Debug|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Release|x64.ActiveCfg = Release|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Release|x64.Build.0 = Release|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Release|x86.ActiveCfg = Release|Any CPU
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {803CD13A-D54B-4CEC-A55F-E22AE3D93B3C} = {037440DE-440B-4129-9F7A-09B42D00397E}
- {3C2D8E01-5580-426A-BDD9-EC59CD98E618} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
- {2BB12CE5-C867-43BD-AE5D-253FE3248C7F} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
- {D7A37F73-BBA3-4DAE-9648-1A753A86F968} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
+ {AB00B377-9F1E-4D4B-B6B0-B95F53BCAEF1} = {791D4267-0D6F-4FDF-80F2-11F4E793B0F2}
+ {37EF0B5E-0363-4A47-AF3E-51FA6E79E3CF} = {290A2775-7CA0-4F81-9DDC-32E28C3A7565}
+ {B11B911D-977A-42CE-900A-596CF59F6FFA} = {290A2775-7CA0-4F81-9DDC-32E28C3A7565}
+ {B4AC7ED9-517B-47E9-BB49-15F8A8478E62} = {290A2775-7CA0-4F81-9DDC-32E28C3A7565}
EndGlobalSection
EndGlobal
diff --git a/Serilog.sln.DotSettings b/Serilog.sln.DotSettings
index 77a52ea2d..a84b8ae38 100644
--- a/Serilog.sln.DotSettings
+++ b/Serilog.sln.DotSettings
@@ -2,10 +2,13 @@
True
+ True
True
True
False
SOLUTION
+ DO_NOT_SHOW
+ DO_NOT_SHOW
DO_NOT_SHOW
ERROR
DO_NOT_SHOW
@@ -16,6 +19,7 @@
ERROR
WARNING
ERROR
+ HINT
ERROR
ERROR
ERROR
@@ -27,8 +31,9 @@
ERROR
DO_NOT_SHOW
DO_NOT_SHOW
- HINT
+ DO_NOT_SHOW
DO_NOT_SHOW
+ HINT
DO_NOT_SHOW
HINT
ERROR
@@ -103,6 +108,7 @@
DO_NOT_SHOW
SUGGESTION
ERROR
+ HINT
ERROR
ERROR
ERROR
@@ -111,6 +117,8 @@
<?xml version="1.0" encoding="utf-16"?><Profile name="Format My Code Using "Particular" conventions"><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_IMPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSReorderTypeMembers>True</CSReorderTypeMembers><JsInsertSemicolon>True</JsInsertSemicolon><JsReformatCode>True</JsReformatCode><CssReformatCode>True</CssReformatCode><CSArrangeThisQualifier>True</CSArrangeThisQualifier><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><HtmlReformatCode>True</HtmlReformatCode><CSShortenReferences>True</CSShortenReferences><CSharpFormatDocComments>True</CSharpFormatDocComments><CssAlphabetizeProperties>True</CssAlphabetizeProperties></Profile>
Default: Reformat Code
Format My Code Using "Particular" conventions
+ Implicit
+ Implicit
False
DO_NOT_CHANGE
DO_NOT_CHANGE
@@ -477,10 +485,13 @@ II.2.12 <HandlesEvent />
True
Automatic property
True
+ False
False
False
+ AD
DB
DTC
+ GT
ID
NSB
SLA
diff --git a/appveyor-perftest.yml b/appveyor-perftest.yml
new file mode 100644
index 000000000..cb30b3e60
--- /dev/null
+++ b/appveyor-perftest.yml
@@ -0,0 +1,7 @@
+version: '{build}'
+skip_tags: true
+image: Visual Studio 2017
+configuration: Release
+test: off
+build_script:
+- ps: ./RunPerfTests.ps1
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
index 185375dde..7df8c2fe4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,21 +1,10 @@
version: '{build}'
skip_tags: true
-image: Visual Studio 2015
+image: Visual Studio 2017
configuration: Release
-install:
- - ps: mkdir -Force ".\build\" | Out-Null
- - 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-003121'
- - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
+test: off
build_script:
- ps: ./Build.ps1
-test_script:
- - nuget.exe install OpenCover -ExcludeVersion
- - OpenCover\tools\OpenCover.Console.exe -register:user -filter:"+[Serilog]*" -target:"dotnet.exe" "-targetargs:test test\Serilog.Tests" -returntargetcode -hideskipped:All -output:coverage.xml
- - "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
- - pip install codecov
- - codecov -f "coverage.xml"
artifacts:
- path: artifacts/Serilog.*.nupkg
deploy:
diff --git a/build.cmd b/build.cmd
new file mode 100644
index 000000000..29af91cd3
--- /dev/null
+++ b/build.cmd
@@ -0,0 +1 @@
+@powershell .\Build.ps1 %*
\ No newline at end of file
diff --git a/build.sh b/build.sh
index ff84facad..9d02afdfc 100755
--- a/build.sh
+++ b/build.sh
@@ -1,17 +1,17 @@
#!/bin/bash
+dotnet --info
dotnet restore
-for path in src/*/project.json; do
- dirname="$(dirname "${path}")"
- dotnet build ${dirname} -c Release
+
+for path in src/**/*.csproj; do
+ dotnet build -f netstandard1.0 -c Release ${path}
+ dotnet build -f netstandard1.3 -c Release ${path}
done
-for path in test/Serilog.Tests/project.json; do
- dirname="$(dirname "${path}")"
- dotnet build ${dirname} -f netcoreapp1.0 -c Release
- dotnet test ${dirname} -f netcoreapp1.0 -c Release
+for path in test/*.Tests/*.csproj; do
+ dotnet test -f netcoreapp1.0 -c Release ${path}
done
-for path in test/Serilog.PerformanceTests/project.json; do
- dirname="$(dirname "${path}")"
- dotnet build ${dirname} -f netcoreapp1.0 -c Release
-done
\ No newline at end of file
+for path in test/*.PerformanceTests/*.PerformanceTests.csproj; do
+ dotnet build -f netcoreapp1.1 -c Release ${path}
+ # dotnet test -f netcoreapp1.1 -c Release ${path}
+done
diff --git a/global.json b/global.json
index a2b2a4152..a88380bf8 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
- "version": "1.0.0-preview2-003121"
+ "version": "1.0.1"
}
}
diff --git a/results/net46/AllocationsBenchmark-report-github.md b/results/net46/AllocationsBenchmark-report-github.md
new file mode 100644
index 000000000..d40893e56
--- /dev/null
+++ b/results/net46/AllocationsBenchmark-report-github.md
@@ -0,0 +1,18 @@
+``` ini
+
+BenchmarkDotNet=v0.10.6, OS=Windows 10 Redstone 1 (10.0.14393)
+Processor=Intel Core i7-4790 CPU 3.60GHz (Haswell), ProcessorCount=8
+Frequency=3507500 Hz, Resolution=285.1033 ns, Timer=TSC
+ [Host] : Clr 4.0.30319.42000, 32bit LegacyJIT-v4.7.2053.0
+ DefaultJob : Clr 4.0.30319.42000, 32bit LegacyJIT-v4.7.2053.0
+
+
+```
+ | Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated |
+ |--------------------- |-------------:|-----------:|-----------:|-------:|---------:|-------:|----------:|
+ | LogEmpty | 9.749 ns | 0.0346 ns | 0.0324 ns | 1.00 | 0.00 | - | 0 B |
+ | LogEmptyWithEnricher | 103.460 ns | 0.1742 ns | 0.1629 ns | 10.61 | 0.04 | 0.0066 | 28 B |
+ | LogScalar | 478.723 ns | 0.6996 ns | 0.6201 ns | 49.11 | 0.17 | 0.0591 | 248 B |
+ | LogDictionary | 3,867.137 ns | 13.5751 ns | 12.6982 ns | 396.67 | 1.79 | 0.3128 | 1324 B |
+ | LogSequence | 1,309.241 ns | 1.4345 ns | 1.3418 ns | 134.30 | 0.45 | 0.1144 | 484 B |
+ | LogAnonymous | 6,128.421 ns | 11.3529 ns | 10.6195 ns | 628.62 | 2.28 | 0.4654 | 1960 B |
diff --git a/results/netcoreapp1.1/AllocationsBenchmark-report-github.md b/results/netcoreapp1.1/AllocationsBenchmark-report-github.md
new file mode 100644
index 000000000..369846ee3
--- /dev/null
+++ b/results/netcoreapp1.1/AllocationsBenchmark-report-github.md
@@ -0,0 +1,19 @@
+``` ini
+
+BenchmarkDotNet=v0.10.6, OS=Windows 10 Redstone 1 (10.0.14393)
+Processor=Intel Core i7-4790 CPU 3.60GHz (Haswell), ProcessorCount=8
+Frequency=3507500 Hz, Resolution=285.1033 ns, Timer=TSC
+dotnet cli version=2.0.0-preview1-005977
+ [Host] : .NET Core 4.6.25211.01, 64bit RyuJIT
+ DefaultJob : .NET Core 4.6.25211.01, 64bit RyuJIT
+
+
+```
+ | Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated |
+ |--------------------- |-------------:|-----------:|-----------:|-------:|---------:|-------:|----------:|
+ | LogEmpty | 8.652 ns | 0.0230 ns | 0.0215 ns | 1.00 | 0.00 | - | 0 B |
+ | LogEmptyWithEnricher | 104.790 ns | 0.4970 ns | 0.4405 ns | 12.11 | 0.06 | 0.0132 | 56 B |
+ | LogScalar | 432.424 ns | 0.6263 ns | 0.5858 ns | 49.98 | 0.14 | 0.1030 | 432 B |
+ | LogDictionary | 3,887.068 ns | 4.4649 ns | 3.7284 ns | 449.26 | 1.16 | 0.5417 | 2296 B |
+ | LogSequence | 1,428.896 ns | 3.6324 ns | 3.2200 ns | 165.15 | 0.53 | 0.2079 | 880 B |
+ | LogAnonymous | 6,694.431 ns | 22.4848 ns | 21.0323 ns | 773.73 | 3.00 | 0.8392 | 3528 B |
diff --git a/run_perf_tests.sh b/run_perf_tests.sh
index 18403fd8e..c332aa20d 100755
--- a/run_perf_tests.sh
+++ b/run_perf_tests.sh
@@ -1,10 +1,6 @@
#!/bin/bash
dotnet restore
-for path in src/*/project.json; do
- dirname="$(dirname "${path}")"
- dotnet build ${dirname} -c Release
-done
-for path in test/Serilog.PerformanceTests/project.json; do
- dirname="$(dirname "${path}")"
- dotnet test ${dirname} -f netcoreapp1.0 -c Release
-done
\ No newline at end of file
+
+for path in test/*.PerformanceTests/*.csproj; do
+ dotnet test -f netcoreapp1.1 -c Release ${path}
+done
diff --git a/src/Serilog/Parameters/DepthLimiter.cs b/src/Serilog/Capturing/DepthLimiter.cs
similarity index 58%
rename from src/Serilog/Parameters/DepthLimiter.cs
rename to src/Serilog/Capturing/DepthLimiter.cs
index e51b23794..005a3be55 100644
--- a/src/Serilog/Parameters/DepthLimiter.cs
+++ b/src/Serilog/Capturing/DepthLimiter.cs
@@ -1,4 +1,4 @@
-// Copyright 2013-2015 Serilog Contributors
+// Copyright 2013-2017 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,43 +12,63 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+using System;
+
using Serilog.Core;
using Serilog.Debugging;
using Serilog.Events;
using Serilog.Parsing;
-namespace Serilog.Parameters
+namespace Serilog.Capturing
{
partial class PropertyValueConverter
{
class DepthLimiter : ILogEventPropertyValueFactory
{
+ [ThreadStatic]
+ static int _currentDepth;
+
readonly int _maximumDestructuringDepth;
- readonly int _currentDepth;
readonly PropertyValueConverter _propertyValueConverter;
- public DepthLimiter(int currentDepth, int maximumDepth, PropertyValueConverter propertyValueConverter)
+ public DepthLimiter(int maximumDepth, PropertyValueConverter propertyValueConverter)
{
_maximumDestructuringDepth = maximumDepth;
- _currentDepth = currentDepth;
_propertyValueConverter = propertyValueConverter;
}
+ public void SetCurrentDepth(int depth)
+ {
+ _currentDepth = depth;
+ }
+
public LogEventPropertyValue CreatePropertyValue(object value, Destructuring destructuring)
{
- return DefaultIfMaximumDepth() ??
- _propertyValueConverter.CreatePropertyValue(value, destructuring, _currentDepth + 1);
+ var storedDepth = _currentDepth;
+
+ var result = DefaultIfMaximumDepth(storedDepth) ??
+ _propertyValueConverter.CreatePropertyValue(value, destructuring, storedDepth + 1);
+
+ _currentDepth = storedDepth;
+
+ return result;
}
- public LogEventPropertyValue CreatePropertyValue(object value, bool destructureObjects = false)
+ LogEventPropertyValue ILogEventPropertyValueFactory.CreatePropertyValue(object value, bool destructureObjects)
{
- return DefaultIfMaximumDepth() ??
- _propertyValueConverter.CreatePropertyValue(value, destructureObjects, _currentDepth + 1);
+ var storedDepth = _currentDepth;
+
+ var result = DefaultIfMaximumDepth(storedDepth) ??
+ _propertyValueConverter.CreatePropertyValue(value, destructureObjects, storedDepth + 1);
+
+ _currentDepth = storedDepth;
+
+ return result;
}
- LogEventPropertyValue DefaultIfMaximumDepth()
+ LogEventPropertyValue DefaultIfMaximumDepth(int depth)
{
- if (_currentDepth == _maximumDestructuringDepth)
+ if (depth == _maximumDestructuringDepth)
{
SelfLog.WriteLine("Maximum destructuring depth reached.");
return new ScalarValue(null);
diff --git a/src/Serilog/Parameters/GetablePropertyFinder.cs b/src/Serilog/Capturing/GetablePropertyFinder.cs
similarity index 98%
rename from src/Serilog/Parameters/GetablePropertyFinder.cs
rename to src/Serilog/Capturing/GetablePropertyFinder.cs
index e7304547f..9c0f74e06 100644
--- a/src/Serilog/Parameters/GetablePropertyFinder.cs
+++ b/src/Serilog/Capturing/GetablePropertyFinder.cs
@@ -17,7 +17,7 @@
using System.Linq;
using System.Reflection;
-namespace Serilog.Parameters
+namespace Serilog.Capturing
{
static class GetablePropertyFinder
{
diff --git a/src/Serilog/Parameters/MessageTemplateProcessor.cs b/src/Serilog/Capturing/MessageTemplateProcessor.cs
similarity index 92%
rename from src/Serilog/Parameters/MessageTemplateProcessor.cs
rename to src/Serilog/Capturing/MessageTemplateProcessor.cs
index 780fed64d..974f6fe8a 100644
--- a/src/Serilog/Parameters/MessageTemplateProcessor.cs
+++ b/src/Serilog/Capturing/MessageTemplateProcessor.cs
@@ -18,11 +18,11 @@
using Serilog.Events;
using Serilog.Parsing;
-namespace Serilog.Parameters
+namespace Serilog.Capturing
{
class MessageTemplateProcessor : ILogEventPropertyFactory
{
- readonly IMessageTemplateParser _parser = new MessageTemplateCache(new MessageTemplateParser());
+ readonly MessageTemplateCache _parser = new MessageTemplateCache(new MessageTemplateParser());
readonly PropertyBinder _propertyBinder;
readonly PropertyValueConverter _propertyValueConverter;
diff --git a/src/Serilog/Parameters/PropertyBinder.cs b/src/Serilog/Capturing/PropertyBinder.cs
similarity index 99%
rename from src/Serilog/Parameters/PropertyBinder.cs
rename to src/Serilog/Capturing/PropertyBinder.cs
index 1461f61c5..23ebd6047 100644
--- a/src/Serilog/Parameters/PropertyBinder.cs
+++ b/src/Serilog/Capturing/PropertyBinder.cs
@@ -19,7 +19,7 @@
using Serilog.Events;
using Serilog.Parsing;
-namespace Serilog.Parameters
+namespace Serilog.Capturing
{
// Performance relevant - on the hot path when creating log events from existing templates.
class PropertyBinder
diff --git a/src/Serilog/Parameters/PropertyValueConverter.cs b/src/Serilog/Capturing/PropertyValueConverter.cs
old mode 100755
new mode 100644
similarity index 61%
rename from src/Serilog/Parameters/PropertyValueConverter.cs
rename to src/Serilog/Capturing/PropertyValueConverter.cs
index 712af6f18..d244271c9
--- a/src/Serilog/Parameters/PropertyValueConverter.cs
+++ b/src/Serilog/Capturing/PropertyValueConverter.cs
@@ -1,4 +1,4 @@
-// Copyright 2013-2015 Serilog Contributors
+// Copyright 2013-2017 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
using Serilog.Policies;
using System.Runtime.CompilerServices;
-namespace Serilog.Parameters
+namespace Serilog.Capturing
{
// Values in Serilog are simplified down into a lowest-common-denominator internal
// type system so that there is a better chance of code written with one sink in
@@ -45,7 +45,7 @@ partial class PropertyValueConverter : ILogEventPropertyFactory, ILogEventProper
readonly IDestructuringPolicy[] _destructuringPolicies;
readonly IScalarConversionPolicy[] _scalarConversionPolicies;
- readonly int _maximumDestructuringDepth;
+ readonly DepthLimiter _depthLimiter;
readonly int _maximumStringLength;
readonly int _maximumCollectionCount;
readonly bool _propagateExceptions;
@@ -63,8 +63,7 @@ public PropertyValueConverter(
if (maximumDestructuringDepth < 0) throw new ArgumentOutOfRangeException(nameof(maximumDestructuringDepth));
if (maximumStringLength < 2) throw new ArgumentOutOfRangeException(nameof(maximumStringLength));
if (maximumCollectionCount < 1) throw new ArgumentOutOfRangeException(nameof(maximumCollectionCount));
-
- _maximumDestructuringDepth = maximumDestructuringDepth;
+
_propagateExceptions = propagateExceptions;
_maximumStringLength = maximumStringLength;
_maximumCollectionCount = maximumCollectionCount;
@@ -72,9 +71,8 @@ public PropertyValueConverter(
_scalarConversionPolicies = new IScalarConversionPolicy[]
{
new SimpleScalarConversionPolicy(BuiltInScalarTypes.Concat(additionalScalarTypes)),
- new NullableScalarConversionPolicy(),
new EnumScalarConversionPolicy(),
- new ByteArrayScalarConversionPolicy(),
+ new ByteArrayScalarConversionPolicy()
};
_destructuringPolicies = additionalDestructuringPolicies
@@ -84,6 +82,8 @@ public PropertyValueConverter(
new ReflectionTypesScalarDestructuringPolicy()
})
.ToArray();
+
+ _depthLimiter = new DepthLimiter(maximumDestructuringDepth, this);
}
public LogEventProperty CreateProperty(string name, object value, bool destructureObjects = false)
@@ -134,21 +134,19 @@ LogEventPropertyValue CreatePropertyValue(object value, Destructuring destructur
}
var valueType = value.GetType();
- var limiter = new DepthLimiter(depth, _maximumDestructuringDepth, this);
+ _depthLimiter.SetCurrentDepth(depth);
if (destructuring == Destructuring.Destructure)
{
- var stringValue = value as string;
- if (stringValue != null)
+ if (value is string stringValue)
{
value = TruncateIfNecessary(stringValue);
}
}
foreach (var scalarConversionPolicy in _scalarConversionPolicies)
- {
- ScalarValue converted;
- if (scalarConversionPolicy.TryConvertToScalar(value, limiter, out converted))
+ {
+ if (scalarConversionPolicy.TryConvertToScalar(value, out var converted))
return converted;
}
@@ -156,14 +154,26 @@ LogEventPropertyValue CreatePropertyValue(object value, Destructuring destructur
{
foreach (var destructuringPolicy in _destructuringPolicies)
{
- LogEventPropertyValue result;
- if (destructuringPolicy.TryDestructure(value, limiter, out result))
+ if (destructuringPolicy.TryDestructure(value, _depthLimiter, out var result))
return result;
}
}
- var enumerable = value as IEnumerable;
- if (enumerable != null)
+ if (TryConvertEnumerable(value, destructuring, valueType, out var enumerableResult))
+ return enumerableResult;
+
+ if (TryConvertValueTuple(value, destructuring, valueType, out var tupleResult))
+ return tupleResult;
+
+ if (TryConvertCompilerGeneratedType(value, destructuring, valueType, out var compilerGeneratedResult))
+ return compilerGeneratedResult;
+
+ return new ScalarValue(value.ToString());
+ }
+
+ bool TryConvertEnumerable(object value, Destructuring destructuring, Type valueType, out LogEventPropertyValue result)
+ {
+ if (value is IEnumerable enumerable)
{
// Only dictionaries with 'scalar' keys are permitted, as
// more complex keys may not serialize to unique values for
@@ -173,36 +183,112 @@ LogEventPropertyValue CreatePropertyValue(object value, Destructuring destructur
// Only actual dictionaries are supported, as arbitrary types
// can implement multiple IDictionary interfaces and thus introduce
// multiple different interpretations.
- if (IsValueTypeDictionary(valueType))
+ if (TryGetDictionary(value, valueType, out var dictionary))
{
- var typeInfo = typeof(KeyValuePair<,>).MakeGenericType(valueType.GenericTypeArguments).GetTypeInfo();
- var keyProperty = typeInfo.GetDeclaredProperty("Key");
- var valueProperty = typeInfo.GetDeclaredProperty("Value");
-
- return new DictionaryValue(enumerable.Cast