rollbar / Rollbar.NET

Rollbar for .NET
https://docs.rollbar.com/docs/dotnet
MIT License
65 stars 44 forks source link

Question: How to use People Tracking in Asp Net Core 5 Web app #602

Closed januszj closed 2 years ago

januszj commented 2 years ago

What is recommended way to enable People Tracking in Asp Net Core 5 Web app I used this guide to setup integration: https://docs.rollbar.com/docs/v5-integrating-with-aspnet-core-2-and-newer It can't done in initialization as this executed only once when app in starting.

Application is using build in Identity, so I'm using:

string userId = User.Identity.Name; 

in Controllers, to get e-mail address/id of current user. This is centralized in my code. So this would be the place to inject person data into Rollbar.

Rollbar Client - Rollbar.NET Hosting Environment (please complete the following information):

akornich commented 2 years ago

@januszj , you can always create an instance of the RollbarLogger in your controller and build a package to send to Rollbar right there with all customization you need. For example, by applying PersonPackageDecorator (with the captured user info) to the package to send. Does it fully answer your question?

januszj commented 2 years ago

Thanks @akornich I will try this