diff --git a/README.md b/README.md index 1bf1c4c..ae27286 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# NLog.AzureAppCenter +# NLog.AppCenter NLog Target for [Microsoft Visual Studio App Center with Azure](https://azure.microsoft.com/services/app-center/) [![Version](https://badge.fury.io/nu/NLog.Targets.AppCenter.svg)](https://www.nuget.org/packages/NLog.Targets.AppCenter) diff --git a/appveyor.yml b/appveyor.yml index 7850604..450c918 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,9 @@ version: 1.0.0.{build} -image: Visual Studio 2017 +image: Visual Studio 2019 configuration: Release platform: Any CPU build_script: -- ps: msbuild /t:restore,pack /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /verbosity:minimal +- ps: msbuild /t:restore,pack /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true /verbosity:minimal test_script: - ps: dotnet test tests\NLog.Targets.AppCenter.Tests\NLog.Targets.AppCenter.Tests.csproj artifacts: diff --git a/src/NLog.Targets.AppCenter/AppCenterTarget.cs b/src/NLog.Targets.AppCenter/AppCenterTarget.cs index c214336..f9f69ac 100644 --- a/src/NLog.Targets.AppCenter/AppCenterTarget.cs +++ b/src/NLog.Targets.AppCenter/AppCenterTarget.cs @@ -139,6 +139,16 @@ protected override void Write(LogEventInfo logEvent) { var eventName = RenderLogEvent(Layout, logEvent); var properties = BuildProperties(logEvent); + + if (string.IsNullOrWhiteSpace(eventName)) + { + // Avoid event being discarded when name is null or empty + if (logEvent.Exception != null) + eventName = logEvent.Exception.GetType().ToString(); + else if (properties?.Count > 0) + eventName = nameof(AppCenterTarget); + } + TrackEvent(eventName, logEvent.Exception, properties); } @@ -178,15 +188,6 @@ private IDictionary BuildProperties(LogEventInfo logEvent) private void TrackEvent(string eventName, Exception exception, IDictionary properties = null) { - if (string.IsNullOrWhiteSpace(eventName)) - { - // Avoid event being discarded when name is null or empty - if (exception != null) - eventName = exception.GetType().ToString(); - else if (properties?.Count > 0) - eventName = nameof(AppCenterTarget); - } - if (ReportExceptionAsCrash && exception != null) { properties = properties ?? new Dictionary(1); diff --git a/src/NLog.Targets.AppCenter/NLog.Targets.AppCenter.csproj b/src/NLog.Targets.AppCenter/NLog.Targets.AppCenter.csproj index 79b5c95..6c1bf12 100644 --- a/src/NLog.Targets.AppCenter/NLog.Targets.AppCenter.csproj +++ b/src/NLog.Targets.AppCenter/NLog.Targets.AppCenter.csproj @@ -2,7 +2,7 @@ net461;netstandard2.0;netstandard1.3 - 2.1.0 + 2.2.0 2.0.0.0 $(APPVEYOR_BUILD_NUMBER) 0 @@ -14,23 +14,32 @@ git https://github.com/NLog/NLog.AppCenter.git AppCenter;NLog;logging;log - https://nlog-project.org/N.png https://github.com/NLog/NLog.AppCenter - https://github.com/NLog/NLog.AppCenter/blob/master/LICENSE + N.png + BSD-3-Clause -- Updated to Microsoft.AppCenter SDK ver. 3.4.3 (Fix Fix naming conflict with Apple iOS 14) +- Updated to Microsoft.AppCenter SDK ver. 4.3.0 (Bug fixes) +- Enabled deterministic build and SourceLink true true true - + + + + - - + + + + + + + diff --git a/tests/NLog.Targets.AppCenter.Tests/NLog.Targets.AppCenter.Tests.csproj b/tests/NLog.Targets.AppCenter.Tests/NLog.Targets.AppCenter.Tests.csproj index 2e1a0ef..3ac7658 100644 --- a/tests/NLog.Targets.AppCenter.Tests/NLog.Targets.AppCenter.Tests.csproj +++ b/tests/NLog.Targets.AppCenter.Tests/NLog.Targets.AppCenter.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + netcoreapp2.1 diff --git a/tests/NLog.Targets.AppCenter.Tests/StringDictionaryTests.cs b/tests/NLog.Targets.AppCenter.Tests/StringDictionaryTests.cs index 158f4c6..a5df1ac 100644 --- a/tests/NLog.Targets.AppCenter.Tests/StringDictionaryTests.cs +++ b/tests/NLog.Targets.AppCenter.Tests/StringDictionaryTests.cs @@ -83,10 +83,10 @@ public void ContainsTest() var objectDictionary = new Dictionary(); var stringDictionary = new StringDictionary(objectDictionary); Assert.False(stringDictionary.ContainsKey("key")); - Assert.False(stringDictionary.Contains(new KeyValuePair("key", "value"))); + Assert.DoesNotContain(new KeyValuePair("key", "value"), stringDictionary); objectDictionary["key"] = "value"; Assert.True(stringDictionary.ContainsKey("key")); - Assert.True(stringDictionary.Contains(new KeyValuePair("key", "value"))); + Assert.Contains(new KeyValuePair("key", "value"), stringDictionary); } [Fact]