Giter VIP home page Giter VIP logo

sentry-elixir's Introduction

sentry

Build Status hex.pm version

The Official Sentry Client for Elixir which provides a simple API to capture exceptions, automatically handle Plug Exceptions and provides a backend for the Elixir Logger.

Documentation

Installation

To use Sentry with your projects, edit your mix.exs file to add it as a dependency and add the :sentry package to your applications:

defp application do
 [applications: [:sentry, :logger]]
end

defp deps do
  [{:sentry, "~> 1.0"}]
end

Setup the application environment in your config/prod.exs

config :sentry,
  dsn: "https://public:[email protected]/1",
  tags: %{
    env: "production"
  }

Capture Exceptions

Sometimes you want to capture specific exceptions, to do so use the Sentry.capture_exception/3.

try do
  ThisWillError.reall()
rescue
  my_exception ->
    Sentry.capture_exception(my_exception, [stacktrace: System.stacktrace(), extra: %{extra: information}])
end

For optional settings check the docs.

Setup with Plug or Phoenix

In your router add the following lines:

use Plug.ErrorHandler
use Sentry.Plug

Capture all Exceptions

This library comes with an extension to capture all Error messages that the Plug handler might not. Simply set use_error_logger to true.

This is based on the Erlang error_logger.

config :sentry,
  use_error_logger: true

Configuration

Key Required Default Notes
dsn True n/a
environment_name False MIX_ENV
included_environments False ~w(prod test dev)a If you need non-standard mix env names you need to include it here
tags False %{}
release False None
server_name False None
use_error_logger False False

Docs

To build the docs locally, you'll need the Sphinx:

$ pip install sphinx

Once Sphinx is available building the docs is simply:

$ make docs

You can then view the docs in your browser:

$ open docs/_build/html/index.html

License

This project is Licensed under the MIT License.

sentry-elixir's People

Contributors

artemeff avatar dcramer avatar flupke avatar gjaldon avatar howleysv avatar lowks avatar mitchellhenke avatar shosti avatar stevedomin avatar teamon avatar vishnevskiy avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.