You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an unofficial library based on the old Raven SDK, the only use case for this is legacy projects (.NET Framework 4.5 to 4.6.0)
For .NET Framework 4.6.1, .NET Core 2.0, Mono 5.4 or higher, please use the new SDK and the Serilog sink.
varlog=newLoggerConfiguration().WriteTo.Sentry("Sentry DSN").Enrich.FromLogContext().CreateLogger();// By default, only messages with level errors and higher are capturedlog.Error("This error goes to Sentry.");
Data scrubbing
Some of the logged content might contain sensitive data and should therefore not be sent to Sentry. When setting up the Sentry Sink it is possible to provide a custom IScrubber implementation which will be passed the serialized data that is about to be sent to Sentry for scrubbing / cleaning.
varlog=newLoggerConfiguration().WriteTo.Sentry("Sentry DSN").Enrich.FromLogContext()// Add this two lines to the logger configuration.Destructure.With<HttpContextDestructingPolicy>().Filter.ByExcluding(e =>e.Exception?.CheckIfCaptured()==true).CreateLogger();
Add Sentry context middleware in Startup.cs
publicvoidConfigure(IApplicationBuilderapp,IHostingEnvironmentenv,ILoggerFactoryloggerFactory){// Add this lineapp.AddSentryContext();// Other stuff}