MindscapeHQ / serilog-sinks-raygun

A Serilog sink that writes events to Raygun
Apache License 2.0
11 stars 20 forks source link

Attach current stack if exception is null #30

Closed QuantumNightmare closed 4 years ago

QuantumNightmare commented 4 years ago

This PR is an alternative to https://github.com/serilog/serilog-sinks-raygun/pull/21 which is related to the case where a message is logged with no Exception instance.

Firstly, the Message has been changed to be formatted with parameters, which looks nicer when displayed in Raygun.

Secondly, the current code-execution Stack is included in place of an Exception Stack. Providing this stack will allow for better and consistent grouping logic when messages are logged to Raygun. Without the Stack, the exception is grouped by the Message and ClassName. Now that the Message includes parameters, that could result in many unique groups. The inclusion of the Stack allows exceptionless log messages to be grouped by where in the code they occur, which is consistent with when an Exception is provided.