Skip to content

Commit 57d64ac

Browse files
authored
Updated to Microsoft.AppCenter ver. 4.3.0 (#23)
1 parent 4ca99b9 commit 57d64ac

File tree

6 files changed

+32
-22
lines changed

6 files changed

+32
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# NLog.AzureAppCenter
1+
# NLog.AppCenter
22
NLog Target for [Microsoft Visual Studio App Center with Azure](https://azure.microsoft.com/services/app-center/)
33

44
[![Version](https://badge.fury.io/nu/NLog.Targets.AppCenter.svg)](https://www.nuget.org/packages/NLog.Targets.AppCenter)

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: 1.0.0.{build}
2-
image: Visual Studio 2017
2+
image: Visual Studio 2019
33
configuration: Release
44
platform: Any CPU
55
build_script:
6-
- ps: msbuild /t:restore,pack /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /verbosity:minimal
6+
- ps: msbuild /t:restore,pack /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true /verbosity:minimal
77
test_script:
88
- ps: dotnet test tests\NLog.Targets.AppCenter.Tests\NLog.Targets.AppCenter.Tests.csproj
99
artifacts:

src/NLog.Targets.AppCenter/AppCenterTarget.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ protected override void Write(LogEventInfo logEvent)
139139
{
140140
var eventName = RenderLogEvent(Layout, logEvent);
141141
var properties = BuildProperties(logEvent);
142+
143+
if (string.IsNullOrWhiteSpace(eventName))
144+
{
145+
// Avoid event being discarded when name is null or empty
146+
if (logEvent.Exception != null)
147+
eventName = logEvent.Exception.GetType().ToString();
148+
else if (properties?.Count > 0)
149+
eventName = nameof(AppCenterTarget);
150+
}
151+
142152
TrackEvent(eventName, logEvent.Exception, properties);
143153
}
144154

@@ -178,15 +188,6 @@ private IDictionary<string, string> BuildProperties(LogEventInfo logEvent)
178188

179189
private void TrackEvent(string eventName, Exception exception, IDictionary<string, string> properties = null)
180190
{
181-
if (string.IsNullOrWhiteSpace(eventName))
182-
{
183-
// Avoid event being discarded when name is null or empty
184-
if (exception != null)
185-
eventName = exception.GetType().ToString();
186-
else if (properties?.Count > 0)
187-
eventName = nameof(AppCenterTarget);
188-
}
189-
190191
if (ReportExceptionAsCrash && exception != null)
191192
{
192193
properties = properties ?? new Dictionary<string, string>(1);

src/NLog.Targets.AppCenter/NLog.Targets.AppCenter.csproj

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net461;netstandard2.0;netstandard1.3</TargetFrameworks>
5-
<VersionPrefix>2.1.0</VersionPrefix>
5+
<VersionPrefix>2.2.0</VersionPrefix>
66
<AssemblyVersion>2.0.0.0</AssemblyVersion> <!-- AssemblyVersion must be fixed on 2.0.0.0 -->
77
<AppVeyorBuildNumber>$(APPVEYOR_BUILD_NUMBER)</AppVeyorBuildNumber>
88
<AppVeyorBuildNumber Condition="'$(AppVeyorBuildNumber)' == ''">0</AppVeyorBuildNumber>
@@ -14,23 +14,32 @@
1414
<RepositoryType>git</RepositoryType>
1515
<RepositoryUrl>https://github.com/NLog/NLog.AppCenter.git</RepositoryUrl>
1616
<PackageTags>AppCenter;NLog;logging;log</PackageTags>
17-
<PackageIconUrl>https://nlog-project.org/N.png</PackageIconUrl>
1817
<PackageProjectUrl>https://github.com/NLog/NLog.AppCenter</PackageProjectUrl>
19-
<PackageLicenseUrl>https://github.com/NLog/NLog.AppCenter/blob/master/LICENSE</PackageLicenseUrl>
18+
<PackageIcon>N.png</PackageIcon>
19+
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
2020
<PackageReleaseNotes>
21-
- Updated to Microsoft.AppCenter SDK ver. 3.4.3 (Fix Fix naming conflict with Apple iOS 14)
21+
- Updated to Microsoft.AppCenter SDK ver. 4.3.0 (Bug fixes)
22+
- Enabled deterministic build and SourceLink
2223
</PackageReleaseNotes>
2324

2425
<IsPackable>true</IsPackable>
2526
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2627
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
27-
28+
2829
</PropertyGroup>
2930

31+
<Target Name="DownloadMissingContent" BeforeTargets="GenerateNuspec">
32+
<DownloadFile SourceUrl="https://nlog-project.org/N.png" DestinationFolder="$(MSBuildThisFileDirectory)" />
33+
</Target>
3034
<ItemGroup>
31-
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="3.4.3" />
32-
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="3.4.3" />
35+
<None Include="N.png" Pack="true" PackagePath="" Visible="false" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.3.0" />
40+
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.3.0" />
3341
<PackageReference Include="NLog" Version="4.5.11" />
42+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
3443
</ItemGroup>
3544

3645
</Project>

tests/NLog.Targets.AppCenter.Tests/NLog.Targets.AppCenter.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

tests/NLog.Targets.AppCenter.Tests/StringDictionaryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public void ContainsTest()
8383
var objectDictionary = new Dictionary<string, object>();
8484
var stringDictionary = new StringDictionary(objectDictionary);
8585
Assert.False(stringDictionary.ContainsKey("key"));
86-
Assert.False(stringDictionary.Contains(new KeyValuePair<string, string>("key", "value")));
86+
Assert.DoesNotContain(new KeyValuePair<string, string>("key", "value"), stringDictionary);
8787
objectDictionary["key"] = "value";
8888
Assert.True(stringDictionary.ContainsKey("key"));
89-
Assert.True(stringDictionary.Contains(new KeyValuePair<string, string>("key", "value")));
89+
Assert.Contains(new KeyValuePair<string, string>("key", "value"), stringDictionary);
9090
}
9191

9292
[Fact]

0 commit comments

Comments
 (0)