Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hayesgm/ravenex
Elixir client for Sentry
https://github.com/hayesgm/ravenex
Last synced: 9 days ago
JSON representation
Elixir client for Sentry
- Host: GitHub
- URL: https://github.com/hayesgm/ravenex
- Owner: hayesgm
- License: mit
- Created: 2016-04-24T00:01:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-06T22:57:11.000Z (about 6 years ago)
- Last Synced: 2024-11-01T03:32:57.610Z (16 days ago)
- Language: Elixir
- Size: 41 KB
- Stars: 11
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Ravenex ![Package Version](https://img.shields.io/hexpm/v/ravenex.svg)
Elixir client for the [Sentry](https://getsentry.com), based on [Airbrakex](https://github.com/fazibear/airbrakex).
## Installation
Add Ravenex as a dependency to your `mix.exs` file:
```elixir
def application do
[applications: [:ravenex]]
enddefp deps do
[{:ravenex, "~> 0.0.1"}]
end
```Then run `mix deps.get` in your shell to fetch the dependencies.
### Configuration
It requires `dsn` configuration parameters to be set
in your application environment, usually defined in your `config/config.exs`.
`logger_level` and `environment` are optional.```elixir
config :ravenex,
dsn: "https://xxx:[email protected]/12345",
logger_level: :error,
environment: Mix.env
```You may also set DSN from a runtime env var:
```elixir
config :ravenex,
dsn: {:system, "RAVEN_DSN"}
```### Scrubber configuration
If you need to scrub data out of the error messages, you can configure regular
expressions that will cleanse the data. The scrubber is configured in config/config.exs
using regular expressions. The scrubber configuration is a tuple of a matching
regular expression string along with a replacement string.```elixir
# Example scrubber configuration
config :revenex,
scrubbers: [
{"password: .+?(\n| )", "password: SCRUBBED\\1"},
{"scrubber regex 2", "scrubber 2 replacement"}
]
```
Scrubbers are a list of tuples with a regular expression string at element one and a replacement string as the second element. The replacement regular expression can use capture groups which can be referenced in the replacement string.## Usage
```elixir
try do
IO.inspect("test",[],"")
rescue
exception -> Ravenex.notify(exception)
end
```### Logger Backend
There is a Logger backend to send logs to the Sentry,
which could be configured as follows:```elixir
config :logger,
backends: [Ravenex.LoggerBackend]
```### Plug
You can plug `Ravenex.Plug` in your web application Plug stack to send all exceptions to Sentry
```elixir
defmodule YourApp.Router do
use Phoenix.Router
use Ravenex.Plug# ...
end
```## Attributions
This project is a direct port of Airbrakex for Sentry. Many thanks to Michał Kalbarczyk for building and releasing that library. Additional code and inspiration from Stanislav Vishnevskiy and [raven-elixir](https://github.com/vishnevskiy/raven-elixir).
- [Airbrakex](https://github.com/fazibear/airbrakex)
- [raven-elixir](https://github.com/vishnevskiy/raven-elixir)