Closed andersekdahl closed 2 years ago
Hi @andersekdahl
Thank you for getting in touch with us. You are correct that the client would need to be exposed to set the current HTTP context details. I will raise this with our product team to see where it aligns with future work on our roadmap. Once I have more information on when this will be started I will be in touch, otherwise feel free to submit a pull request and we can review it for you.
Thank you Mitchell.
Happy to take a stab at a PR, but would it be possible to get some pointers on it?
1) How would you recommend a caller to access the client? Is there any way that this has been done before in Serilog? Just adding a public static property seems kinda rough. 2) Perhaps a better way would be to make it possible to inject a RaygunClient instead of having to expose it from this sink? I'm not familiar enough with Serilog to know if there's any hooks to use for this.
Hi @andersekdahl
You may be right that exposing the current Raygun client may break the API guideline set out by Serilog. Perhaps the approach would be to overload the sink constructors to allow the option of passing in a RaygunClient object.
Regards, Mitchell
Would it be possible to handle this in the same way as userInfo (that is with a ForContext property) where we could send in HttpContext?
Http details are now included with .NET Core exceptions via configuring an Enricher introduced in #42 (though without exposing the Raygun Client like originally suggested). This was released in NuGet package version 5.1.0. I'll close this issue off now - feel free to reopen or create a new issue if needed.
From what I can tell the way you supply HTTP details to
Mindscape.Raygun4Net.AspNetCore.RaygunClient
is by callingSetCurrentContext()
. I can't see that this sink calls that method which I suppose is because this sink wants to be compatible with both Core and Framework, which I understand.Would it be possible to expose the RaygunClient instance that this sink holds, so that
SetCurrentContext
can be called from the outside?