-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from MindscapeHQ/dev
Release v5.2.0
- Loading branch information
Showing
10 changed files
with
284 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
sampleApps/Serilog.Sinks.Raygun.SampleConsoleApp/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Serilog; | ||
using Serilog.Events; | ||
|
||
Console.Out.WriteLine("Please enter your Raygun application key: "); | ||
var raygunApiKey = Console.In.ReadLine(); | ||
|
||
Log.Logger = new LoggerConfiguration() | ||
.MinimumLevel.Verbose() | ||
.WriteTo.Raygun(raygunApiKey, | ||
null, | ||
"CustomUserNameProperty", | ||
"CustomAppVersionProperty", | ||
LogEventLevel.Information, | ||
null, | ||
new[] { "globalTag1", "globalTag2" }, | ||
new[] { "ignoreField1", "ignoreField2" }, | ||
"CustomGroupKeyProperty", | ||
"CustomTagsProperty", | ||
"CustomUserInfoProperty", | ||
onBeforeSendArguments => | ||
{ | ||
Console.Out.WriteLine("OnBeforeSend called with the following arguments: " + onBeforeSendArguments); | ||
//Updating machine name | ||
onBeforeSendArguments.RaygunMessage.Details.MachineName = "Serilog.Sinks.Raygun.SampleConsoleApp Machine"; | ||
|
||
//Testing throwing an exception in Action | ||
throw new Exception("Exception thrown in callback action.."); | ||
|
||
}) | ||
.CreateLogger(); | ||
|
||
try | ||
{ | ||
throw new Exception("Serilog.Sinks.Raygun.SampleConsoleApp"); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.Out.WriteLine("Sending message to Raygun"); | ||
Log.Error(e, "Logging error"); | ||
} | ||
|
||
//A Thread.Sleep is normally not necessary. Adding it here because the app is too small and there might not be enough time to send the errors to Raygun because of the asynchronous Send method used | ||
Thread.Sleep(1000); | ||
|
||
Console.Out.WriteLine("All done! Please check your Raygun App to ensure the two logged exceptions appear"); |
18 changes: 18 additions & 0 deletions
18
...leApps/Serilog.Sinks.Raygun.SampleConsoleApp/Serilog.Sinks.Raygun.SampleConsoleApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Serilog" Version="2.12.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Serilog.Sinks.Raygun\Serilog.Sinks.Raygun.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Serilog.Sinks.Raygun/Sinks/Raygun/OnBeforeSendArguments.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using Mindscape.Raygun4Net; | ||
#if NETSTANDARD2_0 | ||
using Mindscape.Raygun4Net.AspNetCore; | ||
#else | ||
using Mindscape.Raygun4Net.Builders; | ||
using Mindscape.Raygun4Net.Messages; | ||
#endif | ||
|
||
namespace Serilog.Sinks.Raygun | ||
{ | ||
public readonly struct OnBeforeSendArguments | ||
{ | ||
private readonly Exception _exception; | ||
private readonly RaygunMessage _raygunMessage; | ||
|
||
public Exception Exception => _exception; | ||
public RaygunMessage RaygunMessage => _raygunMessage; | ||
|
||
public OnBeforeSendArguments(Exception exception, RaygunMessage raygunMessage) | ||
{ | ||
_exception = exception; | ||
_raygunMessage = raygunMessage; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
test/Serilog.Sinks.Raygun.Tests/Serilog.Sinks.Raygun.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.