Kydd
Use different Logging provider depending on the context
In my .NET 7 web-app, I want to send some logs to different Logging Providers depending on the User of the request.
It seems that this should be doable, but I am not sure how to set this up. Should I enable all loggers, and then use filters? Or should I
inject user-specific logger in the DI?
For instance,
When a User A does a request to my app, it will log to Console Logger and Serilog. If a User B makes a request, it will log to Sentry and Serilog (with a different configuration).
How can I achieve this?
3 replies