我不知道如何从 IdentityUser 全局将人员添加到 RollBar。
这是我在 Startup.cs 中的所有 Rollbar 配置。我需要帮助。谢谢你的帮助。
启动.cs
public void ConfigureServices(IServiceCollection services) {
ConfigureRollbarSingleton();
services.AddRollbarLogger(loggerOptions =>
{
loggerOptions.Filter = (loggerName, loglevel) => loglevel >=
LogLevel.Error;
});
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
}
private void ConfigureRollbarSingleton() {
Person person = new Person() {
// how access to current user id, email and name?
Email = "...",
Id = "...",
UserName = "..."
};
RollbarLocator.RollbarInstance
// minimally required Rollbar configuration:
.Configure(new RollbarConfig(rollbarAccessToken) {
Environment = rollbarEnvironment
})
.Config.Person = person;;
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseRollbarMiddleware();
}