Packages

A logger backend for posting errors to HipChat.

Current section

Files

Jump to
hipchat_logger_backend lib hipchat_logger_backend.ex
Raw

lib/hipchat_logger_backend.ex

defmodule HipchatLoggerBackend do
@moduledoc """
A logger backend for posting errors to Hipchat.
## Usage
First, add the client to your `mix.exs` dependencies:
```elixir
def deps do
[{:hipchat_logger_backend, "~> 0.0.1"}]
end
```
Then run `$ mix do deps.get, compile` to download and compile your dependencies.
Finally, add the `:hipchat_logger_backend` application as your list of applications in `mix.exs`:
```elixir
def application do
[applications: [:logger, :hipchat_logger_backend]]
end
```
You can set the log levels you want posted to hipchat in the config:
```elixir
config :hipchat_logger_backend, :levels, [:debug, :info, :warn, :error]
```
"""
use Application
require Logger
@doc false
def start(_, _) do
import Supervisor.Spec, warn: false
Logger.add_backend(HipchatLogger)
children = []
opts = [strategy: :one_for_one, name: HipchatLoggerBackend.Supervisor]
Supervisor.start_link(children, opts)
end
@doc false
def stop(_) do
:ok
end
end