diff --git a/Build.ps1 b/Build.ps1 index ee4117d..3dee0bd 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -11,7 +11,7 @@ if(Test-Path .\artifacts) { $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.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] +$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"] $commitHash = $(git rev-parse --short HEAD) $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] @@ -23,7 +23,7 @@ foreach ($src in ls src/*) { echo "build: Packaging project in $src" - & dotnet build -c Release --version-suffix=$buildSuffix + & dotnet build -c Release --version-suffix=$buildSuffix -p:ContinuousIntegrationBuild=true if ($suffix) { & dotnet pack -c Release --include-source -o ..\..\artifacts --version-suffix=$suffix --no-build } else { diff --git a/README.md b/README.md index 038a8c9..411d5e5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Serilog.Sinks.Debug [![Build status](https://ci.appveyor.com/api/projects/status/oufg4e51868oq4eu?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-debug) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.Debug.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.Debug/) [![Documentation](https://img.shields.io/badge/docs-wiki-yellow.svg)](https://github.com/serilog/serilog/wiki) [![Join the chat at https://gitter.im/serilog/serilog](https://img.shields.io/gitter/room/serilog/serilog.svg)](https://gitter.im/serilog/serilog) [![Help](https://img.shields.io/badge/stackoverflow-serilog-orange.svg)](http://stackoverflow.com/questions/tagged/serilog) +# Serilog.Sinks.Debug [![Build status](https://ci.appveyor.com/api/projects/status/oufg4e51868oq4eu?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-debug) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.Debug.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.Debug/) [![Help](https://img.shields.io/badge/stackoverflow-serilog-orange.svg)](http://stackoverflow.com/questions/tagged/serilog) A Serilog sink that writes log events to the Visual Studio debug output window. @@ -7,7 +7,7 @@ A Serilog sink that writes log events to the Visual Studio debug output window. To use the sink, first install the [NuGet package](https://nuget.org/packages/serilog.sinks.debug): ```powershell -Install-Package Serilog.Sinks.Debug +dotnet add package Serilog.Sinks.Debug ``` Then enable the sink using `WriteTo.Debug()`: diff --git a/appveyor.yml b/appveyor.yml index 5b6e397..09f9730 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,23 +1,26 @@ version: '{build}' skip_tags: true -image: Visual Studio 2019 +image: Visual Studio 2022 configuration: Release test: off build_script: - ps: ./Build.ps1 artifacts: - path: artifacts/Serilog.*.nupkg +- path: artifacts/Serilog.*.snupkg deploy: - provider: NuGet api_key: - secure: K3/810hkTO6rd2AEHVkUQAadjGmDREus9k96QHu6hxrA1/wRTuAJemHMKtVVgIvf + secure: sDnchSg4TZIOK7oIUI6BJwFPNENTOZrGNsroGO1hehLJSvlHpFmpTwiX8+bgPD+Q skip_symbols: true on: - branch: /^(master|dev)$/ + branch: /^(main|dev)$/ - provider: GitHub auth_token: secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX - artifact: /Serilog.*\.nupkg/ + artifacts: + /Serilog.*\.nupkg/ + /Serilog.*\.snupkg/ tag: v$(appveyor_build_version) on: - branch: master + branch: main diff --git a/global.json b/global.json deleted file mode 100644 index 2cb2ac9..0000000 --- a/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "5.0.100" - } -} \ No newline at end of file diff --git a/sample/DebugDemo/DebugDemo.csproj b/sample/DebugDemo/DebugDemo.csproj index b46bffa..24278ce 100644 --- a/sample/DebugDemo/DebugDemo.csproj +++ b/sample/DebugDemo/DebugDemo.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net8.0 diff --git a/src/Serilog.Sinks.Debug/Serilog.Sinks.Debug.csproj b/src/Serilog.Sinks.Debug/Serilog.Sinks.Debug.csproj index a705177..ce087af 100644 --- a/src/Serilog.Sinks.Debug/Serilog.Sinks.Debug.csproj +++ b/src/Serilog.Sinks.Debug/Serilog.Sinks.Debug.csproj @@ -2,9 +2,14 @@ A Serilog sink that writes log events to the debug output window. - 2.0.0 + 3.0.0 Serilog Contributors - net45;net46;netstandard1.0;netstandard2.0;netstandard2.1 + + net471;net462 + + $(TargetFrameworks);net8.0;net6.0;netstandard2.0 Serilog.Sinks.Debug ../../assets/Serilog.snk true @@ -14,11 +19,12 @@ https://github.com/serilog/serilog-sinks-debug Apache-2.0 icon.png - https://github.com/serilog/serilog-sinks-debug - git + README.md + true + true + true + snupkg true - - true True Serilog @@ -29,19 +35,12 @@ - + - - - - - - $(DefineConstants);DEBUG_WRITE - - + diff --git a/src/Serilog.Sinks.Debug/Sinks/Debug/DebugSink.cs b/src/Serilog.Sinks.Debug/Sinks/Debug/DebugSink.cs index 3946eca..6c3e5cd 100644 --- a/src/Serilog.Sinks.Debug/Sinks/Debug/DebugSink.cs +++ b/src/Serilog.Sinks.Debug/Sinks/Debug/DebugSink.cs @@ -20,7 +20,7 @@ namespace Serilog.Sinks.Debug { - class DebugSink : ILogEventSink + sealed class DebugSink : ILogEventSink { readonly ITextFormatter _formatter; @@ -34,11 +34,7 @@ public void Emit(LogEvent logEvent) using (var buffer = new StringWriter()) { _formatter.Format(logEvent, buffer); -#if DEBUG_WRITE System.Diagnostics.Debug.Write(buffer.ToString()); -#else - System.Diagnostics.Debug.WriteLine(buffer.ToString().Trim()); -#endif } } } diff --git a/test/Serilog.Sinks.Debug.Tests/Serilog.Sinks.Debug.Tests.csproj b/test/Serilog.Sinks.Debug.Tests/Serilog.Sinks.Debug.Tests.csproj index caa2ba5..6e8c908 100644 --- a/test/Serilog.Sinks.Debug.Tests/Serilog.Sinks.Debug.Tests.csproj +++ b/test/Serilog.Sinks.Debug.Tests/Serilog.Sinks.Debug.Tests.csproj @@ -1,10 +1,11 @@  - net5.0 + net8.0;net48 ../../assets/Serilog.snk true true + false @@ -12,10 +13,12 @@ - - - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + +