Skip to content

Commit

Permalink
Merge pull request #20 from serilog/dev
Browse files Browse the repository at this point in the history
4.0.0 Release
  • Loading branch information
nblumhardt authored Feb 18, 2020
2 parents e628aa7 + 3bd4175 commit 4cb1b93
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ artifacts:
deploy:
- provider: NuGet
api_key:
secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
secure: eY0pNgTWxzEUVfkitD3R/g5Qfg2GVLYdiJiyvnwfiOLBd2FMRRrJKD89j8XMeK9A
skip_symbols: true
on:
branch: /^(master|dev)$/
Expand All @@ -22,4 +22,4 @@ deploy:
artifact: /Serilog.*\.nupkg/
tag: v$(appveyor_build_version)
on:
branch: master
branch: master
22 changes: 13 additions & 9 deletions src/Serilog.Sinks.Raygun/Serilog.Sinks.Raygun.csproj
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net46;net461</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Michiel van Oudheusden</Authors>
<Company>Serilog</Company>
<Product>Serilog.Sinks.Raygun</Product>
<Description>Send log events to custom topics in Azure Event Grid</Description>
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>http://serilog.net</PackageProjectUrl>
<PackageIconUrl>http://serilog.net/images/serilog-sink-nuget.png</PackageIconUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/serilog/serilog-sinks-raygun</RepositoryUrl>
<PackageTags>serilog sink raygun</PackageTags>
<Copyright>Copyright © Serilog Contributors 2017</Copyright>
<Copyright>Copyright © Serilog Contributors 2017-2019</Copyright>
<Description>Serilog event sink that writes to the Raygun.io service.</Description>
<Version>3.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<VersionPrefix>4.0.0</VersionPrefix>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>4.0.0.0</FileVersion>
</PropertyGroup>


<ItemGroup Condition="'$(TargetFramework)' == 'net46'">
<PackageReference Include="Mindscape.Raygun4Net" Version="5.5.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="Mindscape.Raygun4Net" Version="5.5.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="mindscape.Raygun4Net.AspNetCore" Version="5.5.0" />
<PackageReference Include="mindscape.Raygun4Net.AspNetCore" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
24 changes: 14 additions & 10 deletions src/Serilog.Sinks.Raygun/Sinks/Raygun/RaygunSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
// limitations under the License.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Mindscape.Raygun4Net;
#if NETSTANDARD2_0
using Mindscape.Raygun4Net.AspNetCore;
#else
using Mindscape.Raygun4Net.Builders;
using Mindscape.Raygun4Net.Messages;
#endif
using Serilog.Core;
using Serilog.Events;

Expand Down Expand Up @@ -100,9 +102,15 @@ public void Emit(LogEvent logEvent)
OccurredOn = logEvent.Timestamp.UtcDateTime
};

// Add exception when available
if (logEvent.Exception != null)
raygunMessage.Details.Error = RaygunErrorMessageBuilder.Build(logEvent.Exception);
// Add exception when available, else use the message template so events can be grouped
raygunMessage.Details.Error = logEvent.Exception != null
? RaygunErrorMessageBuilder.Build(logEvent.Exception)
: new RaygunErrorMessage()
{
ClassName = logEvent.MessageTemplate.Text,
Message = logEvent.MessageTemplate.Text,
Data = logEvent.Properties.ToDictionary(k => k.Key, v => v.Value.ToString())
};

// Add user when requested
if (!string.IsNullOrWhiteSpace(_userNameProperty) &&
Expand Down Expand Up @@ -138,11 +146,7 @@ public void Emit(LogEvent logEvent)
}

// Submit
#if NETSTANDARD2_0
_client.Send(raygunMessage).Wait();
#else
_client.Send(raygunMessage);
#endif
_client.SendInBackground(raygunMessage);
}
}
}

0 comments on commit 4cb1b93

Please sign in to comment.