From 955d5f01c99ae117d781a2e4266735b278ae37b9 Mon Sep 17 00:00:00 2001 From: Matthew Erbs Date: Tue, 17 May 2016 18:56:54 +1000 Subject: [PATCH 1/5] .NET Core RC2 Update --- Build.ps1 | 108 ++---------------- README.md | 6 +- .../ConsoleLoggerConfigurationExtensions.cs | 3 + .../Serilog.Sinks.Console.xproj | 2 +- src/Serilog.Sinks.Console/project.json | 26 +++-- 5 files changed, 33 insertions(+), 112 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 2e01b0d..09912b2 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -1,109 +1,21 @@ -$root = $(Get-Item $($MyInvocation.MyCommand.Path)).DirectoryName - -function Install-Dnvm -{ - & where.exe dnvm 2>&1 | Out-Null - if(($LASTEXITCODE -ne 0) -Or ((Test-Path Env:\APPVEYOR) -eq $true)) - { - Write-Host "DNVM not found" - &{$Branch='dev';iex ((New-Object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))} - - # Normally this happens automatically during install but AppVeyor has - # an issue where you may need to manually re-run setup from within this process. - if($env:DNX_HOME -eq $NULL) - { - Write-Host "Initial DNVM environment setup failed; running manual setup" - $tempDnvmPath = Join-Path $env:TEMP "dnvminstall" - $dnvmSetupCmdPath = Join-Path $tempDnvmPath "dnvm.ps1" - & $dnvmSetupCmdPath setup - } - } -} - -function Get-DnxVersion -{ - $globalJson = Join-Path $PSScriptRoot "global.json" - $jsonData = Get-Content -Path $globalJson -Raw | ConvertFrom-JSON - return $jsonData.sdk.version -} - -function Restore-Packages -{ - param([string] $DirectoryName) - & dnu restore ("""" + $DirectoryName + """") -} - -function Build-Projects -{ - param($Directory, $pack) - - $DirectoryName = $Directory.DirectoryName - $artifactsFolder = join-path $root "artifacts" - $projectsFolder = join-path $artifactsFolder $Directory.Name - $buildFolder = join-path $projectsFolder "testbin" - $packageFolder = join-path $projectsFolder "packages" - - & dnu build ("""" + $DirectoryName + """") --configuration Release --out $buildFolder; if($LASTEXITCODE -ne 0) { exit 1 } - - if($pack){ - & dnu pack ("""" + $DirectoryName + """") --configuration Release --out $packageFolder; if($LASTEXITCODE -ne 0) { exit 1 } - } -} - -function Test-Projects -{ - param([string] $DirectoryName) - & dnx -p ("""" + $DirectoryName + """") test; if($LASTEXITCODE -ne 0) { exit 2 } -} - -function Remove-PathVariable -{ - param([string] $VariableToRemove) - $path = [Environment]::GetEnvironmentVariable("PATH", "User") - $newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User") - $path = [Environment]::GetEnvironmentVariable("PATH", "Process") - $newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process") -} - Push-Location $PSScriptRoot -$dnxVersion = Get-DnxVersion - -# Clean if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse } -# Remove the installed DNVM from the path and force use of -# per-user DNVM (which we can upgrade as needed without admin permissions) -Remove-PathVariable "*Program Files\Microsoft DNX\DNVM*" - -# Make sure per-user DNVM is installed -Install-Dnvm +& dotnet restore -# Install DNX -dnvm install $dnxVersion -r CoreCLR -NoNative -dnvm install $dnxVersion -r CLR -NoNative -dnvm use $dnxVersion -r CLR +$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; -# Package restore -Get-ChildItem -Path . -Filter *.xproj -Recurse | ForEach-Object { Restore-Packages $_.DirectoryName } +Push-Location src/Serilog.Sinks.TextWriter -# Set build number -$env:DNX_BUILD_VERSION = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; -Write-Host "Build number: " $env:DNX_BUILD_VERSION +& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision +if($LASTEXITCODE -ne 0) { exit 1 } -# Build/package -Get-ChildItem -Path .\src -Filter *.xproj -Recurse | ForEach-Object { Build-Projects $_ $true } -Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Build-Projects $_ $false } - -# Test -Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Test-Projects $_.DirectoryName } - -# Switch to Core CLR -dnvm use $dnxVersion -r CoreCLR +Pop-Location +Push-Location test/Serilog.Tests -# Test again -Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Test-Projects $_.DirectoryName } +& dotnet test -c Release +if($LASTEXITCODE -ne 0) { exit 2 } Pop-Location +Pop-Location \ No newline at end of file diff --git a/README.md b/README.md index dfe4ec4..b504c65 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# The console sink for Serilog. - -##NOTE: Work in progress as apart of the [Serilog 2.0 release](https://github.com/serilog/serilog/issues?q=is%3Aissue+is%3Aopen+label%3Av2). +# Serilog.Sinks.Console +The console sink for Serilog. + [![Build status](https://ci.appveyor.com/api/projects/status/w1w3m1wyk3in1c96/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-console/branch/master) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.Console.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.Console/) * [Documentation](https://github.com/serilog/serilog/wiki) diff --git a/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs b/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs index 12d2c14..8df3fb4 100644 --- a/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs +++ b/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs @@ -7,6 +7,9 @@ namespace Serilog { + /// + /// Adds the WriteTo.Console() extension method to . + /// public static class ConsoleLoggerConfigurationExtensions { const string DefaultConsoleOutputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}"; diff --git a/src/Serilog.Sinks.Console/Serilog.Sinks.Console.xproj b/src/Serilog.Sinks.Console/Serilog.Sinks.Console.xproj index 9417ec0..9e72827 100644 --- a/src/Serilog.Sinks.Console/Serilog.Sinks.Console.xproj +++ b/src/Serilog.Sinks.Console/Serilog.Sinks.Console.xproj @@ -14,5 +14,5 @@ 2.0 - + \ No newline at end of file diff --git a/src/Serilog.Sinks.Console/project.json b/src/Serilog.Sinks.Console/project.json index 0c2cc9a..b06cca2 100644 --- a/src/Serilog.Sinks.Console/project.json +++ b/src/Serilog.Sinks.Console/project.json @@ -1,23 +1,29 @@ { "version": "2.0.0-beta-*", "description": "The console sink for Serilog.", - "authors": [ "Serilog Contributors" ], - "tags": [ "serilog", "console" ], - "projectUrl": "http://serilog.net", - "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0", - "iconUrl": "http://serilog.net/images/serilog-sink-nuget.png", + "authors": [ + "Serilog Contributors" + ], + "packOptions": { + "tags": [ + "serilog", + "console" + ], + "projectUrl": "http://serilog.net", + "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0", + "iconUrl": "http://serilog.net/images/serilog-sink-nuget.png" + }, "dependencies": { - "Serilog": "2.0.0-beta-505" + "Serilog": "2.0.0-rc-556" }, "compilationOptions": { "keyFile": "../../assets/Serilog.snk" }, "frameworks": { - "net45": { - }, - "dotnet5.1": { + "net4.5": {}, + "netstandard1.0": { "dependencies": { - "System.Console": "4.0.0-beta-23516" + "System.Console": "4.0.0-rc2-24027" } } } From cdd9437945f5d958dc31d89865bf27c69228a7da Mon Sep 17 00:00:00 2001 From: Matthew Erbs Date: Tue, 17 May 2016 19:11:18 +1000 Subject: [PATCH 2/5] Added YAML build file. --- appveyor.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..a1bc9e3 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,21 @@ +version: '{build}' +image: Visual Studio 2015 +configuration: Release +install: + - ps: mkdir -Force ".\build\" | Out-Null + - ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1" -OutFile ".\build\installcli.ps1" + - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli" + - ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath' + - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path" +build_script: +- ps: ./Build.ps1 +test: off +artifacts: +- path: artifacts/Serilog.*.nupkg +deploy: +- provider: NuGet + api_key: + secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x + skip_symbols: true + on: + branch: /^(dev|master)$/ \ No newline at end of file From 0d379c73a702ac1edf5c50396b9ba46634071bc2 Mon Sep 17 00:00:00 2001 From: Matthew Erbs Date: Tue, 17 May 2016 19:16:31 +1000 Subject: [PATCH 3/5] Changed target to 1.3 --- src/Serilog.Sinks.Console/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serilog.Sinks.Console/project.json b/src/Serilog.Sinks.Console/project.json index b06cca2..674ac8f 100644 --- a/src/Serilog.Sinks.Console/project.json +++ b/src/Serilog.Sinks.Console/project.json @@ -21,7 +21,7 @@ }, "frameworks": { "net4.5": {}, - "netstandard1.0": { + "netstandard1.3": { "dependencies": { "System.Console": "4.0.0-rc2-24027" } From 52902b00187f4d8cd65ba89f1ae3f6da58d09692 Mon Sep 17 00:00:00 2001 From: Matthew Erbs Date: Tue, 17 May 2016 19:26:28 +1000 Subject: [PATCH 4/5] Copy/Paste.. --- Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build.ps1 b/Build.ps1 index 09912b2..dc4e965 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -6,7 +6,7 @@ if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse } $revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; -Push-Location src/Serilog.Sinks.TextWriter +Push-Location src/Serilog.Sinks.Console & dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision if($LASTEXITCODE -ne 0) { exit 1 } From 2c6f8a0a225d875828e559127eb5a66ad3c88387 Mon Sep 17 00:00:00 2001 From: Matthew Erbs Date: Tue, 17 May 2016 19:35:26 +1000 Subject: [PATCH 5/5] Use buildOptions and corrected build as no tests exist. --- Build.ps1 | 6 ------ src/Serilog.Sinks.Console/project.json | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index dc4e965..5af58ed 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -11,11 +11,5 @@ Push-Location src/Serilog.Sinks.Console & dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision if($LASTEXITCODE -ne 0) { exit 1 } -Pop-Location -Push-Location test/Serilog.Tests - -& dotnet test -c Release -if($LASTEXITCODE -ne 0) { exit 2 } - Pop-Location Pop-Location \ No newline at end of file diff --git a/src/Serilog.Sinks.Console/project.json b/src/Serilog.Sinks.Console/project.json index 674ac8f..2af005c 100644 --- a/src/Serilog.Sinks.Console/project.json +++ b/src/Serilog.Sinks.Console/project.json @@ -16,7 +16,7 @@ "dependencies": { "Serilog": "2.0.0-rc-556" }, - "compilationOptions": { + "buildOptions": { "keyFile": "../../assets/Serilog.snk" }, "frameworks": {