Skip to content

Provides a `Logger` backend for Sentry, to automatically submit Logger events above a configurable threshold to Sentry

Notifications You must be signed in to change notification settings

SimonWoolf/sentry-logger-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecation notice

As of sentry-elixir 7.0, Sentry now ship their own Sentry.LoggerBackend (including in 8.0 the ability to sent non-exception messages to Sentry), which should be used instead of this. As a result this project is now deprecated. Users are recommended to migrate to the new official Sentry.LoggerBackend as and when they upgrade their sentry-elixir version.

SentryLoggerBackend

Provides a Logger backend for Sentry, to automatically submit Logger events above a configurable threshold to Sentry

Installation

  1. Add sentry_logger_backend to your list of dependencies in mix.exs:
def deps do
  [{:sentry_logger_backend, "~> 0.1.0"}]
end
  1. Add SentryLoggerBackend to the list of logger backends in your config, e.g.
config :logger, backends: [:console, SentryLoggerBackend]
  1. Set the level threshold (defaults to :error - but see warning below):
config :logger, SentryLoggerBackend, level: :error

Fingerprints

Can supply a custom fingerprint to a Logger call with the fingerprint metadata, which should be a list(String.t) (see Sentry's documentation for more info). For example:

Logger.warn "oh no - #{debugging data that's different each time}", fingerprint: ["oh-no"]

Please note if setting level to :warn, :info, or :debug

The current version of elixir-sentry logs problems encountered while posting to sentry at the :warn level.

That means that if you configure the level threshold to anything other than :error, and there's a problem posting to sentry, then this can result in an infinite loop of error-posting attempts.

The suggested solution for now, if you want to use a threshold other than :error, is to use my fork of sentry-elixir, which adds :skip_sentry metadata to that logger call. Future plans are to include a custom http client in sentry-logger-backend, see #1 .

License

This project is licensed under the MIT License.

About

Provides a `Logger` backend for Sentry, to automatically submit Logger events above a configurable threshold to Sentry

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages