All Projects → serilog-contrib → serilog-sinks-sentry

serilog-contrib / serilog-sinks-sentry

Licence: MIT license
A Sentry sink for Serilog

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to serilog-sinks-sentry

Sentry Self Hosted
Self-host Sentry for $5 per month
Stars: ✭ 132 (+288.24%)
Mutual labels:  sentry
Redux Catch
Error catcher middleware for Redux reducers and sync middlewares
Stars: ✭ 150 (+341.18%)
Mutual labels:  sentry
Terraform Provider Sentry
Terraform provider for Sentry
Stars: ✭ 183 (+438.24%)
Mutual labels:  sentry
Raven Python
Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
Stars: ✭ 1,677 (+4832.35%)
Mutual labels:  sentry
Raven Weapp
Sentry SDK for WeApp
Stars: ✭ 142 (+317.65%)
Mutual labels:  sentry
Django Guid
Inject an ID into every log message from a Django request. ASGI compatible, integrates with Sentry, and works with Celery
Stars: ✭ 166 (+388.24%)
Mutual labels:  sentry
Sentry Mina
小程序 Sentry SDK
Stars: ✭ 124 (+264.71%)
Mutual labels:  sentry
sentry-wxwork
Plugin for Sentry which allows sending notification and SSO Login via WeChat Work.
Stars: ✭ 30 (-11.76%)
Mutual labels:  sentry
Serverless Sentry Plugin
This plugin adds automatic forwarding of errors and exceptions to Sentry (https://sentry.io) and Serverless (https://serverless.com)
Stars: ✭ 146 (+329.41%)
Mutual labels:  sentry
Slashtrace
Awesome error handler. Demo: https://slashtrace.com/demo.php
Stars: ✭ 182 (+435.29%)
Mutual labels:  sentry
Graphql Middleware Sentry
🗃 A GraphQL Middleware plugin for Sentry.
Stars: ✭ 141 (+314.71%)
Mutual labels:  sentry
Hwamei
企业微信webhook,企业微信群机器人webhook,支持Github、Gitlab、Sentry等Webhook
Stars: ✭ 142 (+317.65%)
Mutual labels:  sentry
Sentry Telegram
Plugin for Sentry which allows sending notification via Telegram messenger.
Stars: ✭ 168 (+394.12%)
Mutual labels:  sentry
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+302.94%)
Mutual labels:  sentry
Sentry Docker
my approach for dockerizing Sentry
Stars: ✭ 195 (+473.53%)
Mutual labels:  sentry
Gatsby Starter Lumen
A constantly evolving and thoughtful architecture for creating static blogs.
Stars: ✭ 1,797 (+5185.29%)
Mutual labels:  sentry
Cfworker
A collection of packages optimized for Cloudflare Workers and service workers.
Stars: ✭ 152 (+347.06%)
Mutual labels:  sentry
react-native-template
An opinionated template to bootstrap your next React Native app with all the time-wasting packages you need to have.
Stars: ✭ 132 (+288.24%)
Mutual labels:  sentry
Blog
若川的博客—学习源码整体架构系列8篇,前端面试高频源码,微信搜索「若川视野」关注我,长期交流学习~
Stars: ✭ 234 (+588.24%)
Mutual labels:  sentry
Wp Sentry
A (unofficial) WordPress plugin reporting PHP and JavaScript errors to Sentry.
Stars: ✭ 174 (+411.76%)
Mutual labels:  sentry

Serilog.Sinks.Sentry

Note

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.

Build status Quality Gate

Package
Serilog.Sinks.Sentry NuGet
Serilog.Sinks.Sentry.AspNetCore NuGet

A Sentry sink for Serilog.

Installation

The library is available as a Nuget package.

Install-Package Serilog.Sinks.Sentry

Demos

You can find demo .NET Core apps here.

Get started

Adding Sentry sink

var log = new LoggerConfiguration()
    .WriteTo.Sentry("Sentry DSN")
    .Enrich.FromLogContext()
    .CreateLogger();

// By default, only messages with level errors and higher are captured
log.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.

Adding a scrubber would look like this:

var log = new LoggerConfiguration()
    .WriteTo.Sentry("Sentry DSN", dataScrubber: new MyDataScrubber())
    .Enrich.FromLogContext()
    .CreateLogger();

MyDataScrubber has to implement the interface SharpRaven.Logging.IScrubber. Check the Web Demo Startup.cs for further details and the example implementation of a scrubber .

Capturing HttpContext (ASP.NET Core)

In order to capture a user, request body and headers, some additional steps are required.

Install the additional sink for ASP.NET Core

Install-Package Serilog.Sinks.Sentry.AspNetCore

Specify custom HttpContext destructing policy

var log = new LoggerConfiguration()
    .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

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    // Add this line
    app.AddSentryContext();

    // Other stuff
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].