This is an Elixir client for the Rollbar service.
Add Rollbax as a dependency to your mix.exs
file:
def application() do
[applications: [:rollbax]]
end
defp deps() do
[{:rollbax, "~> 0.5"}]
end
Then run mix deps.get
in your shell to fetch the dependencies.
It requires access_token
and environment
parameters to be set
in your application environment, usually defined in your config/config.exs
:
config :rollbax,
access_token: "ffb8056a621f309eeb1ed87fa0c7",
environment: "production"
try do
DoesNotExist.for_sure()
rescue
exception ->
Rollbax.report(exception, System.stacktrace())
end
There is a Logger backend to send logs to the Rollbar, which could be configured as follows:
config :logger,
backends: [Rollbax.Notifier]
config :logger, Rollbax.Notifier,
level: :error
The Rollbax log sending can be disabled by using Logger metadata:
Logger.metadata(rollbar: false)
# For a single call
Logger.error("oops", rollbar: false)
For non-production environments error reporting can be disabled or turned into logging:
config :rollbax, enabled: :log
This software is licensed under the ISC license.