velreine
ILogger<T> extension method "pass the args".
I am trying to create an extension method on ILogger<T> called
LogPermissionDenied
.
I have a custom IPermissionDeniedErrorFragment
which is an auto-generated interface from Strawberry shake based on a GraphQL fragment, that doesn't really matter that much, it is just to provide some context.
The ILogger<T>
has a method called LogError
with an overload that accepts an string message
and a params object?[] args
I want to be able to call the LogPermissionDenied
function and call it with a string that is contextual to the location it occurs in the code, the extension method should then append some more information regarding the permission that was denied.
Here is the implementation of the extension method itself (I have attempted a few things but this is what it looks like so far.)
This is how i want to use that extension method:
Its important the params will appear in customDimensions
in Application Insights, and that it is not possible to "screw up" the params (since they are positional).
Any ideas?1 replies