slack_logger_backend v0.1.6 SlackLogger

A logger backend for posting errors to Slack.

You can find the hex package here, and the docs here.

Usage

First, add the client to your mix.exs dependencies:

def deps do
  [{:slack_logger_backend, "~> 0.0.1"}]
end

Then run $ mix do deps.get, compile to download and compile your dependencies.

Finally, add SlackLogger to your list of logging backends in your app’s config:

config :logger, backends: [SlackLogger, :console]

You can set the log levels you want posted to slack in the config:

config SlackLogger, :levels, [:debug, :info, :warn, :error]

Alternatively, do both in one step:

config :logger, backends: [{SlackLogger, :error}]
config :logger, backends: [{SlackLogger, [:info, error]}]

You’ll need to create a custom incoming webhook URL for your Slack team. You can either configure the webhook in your config:

config SlackLogger, :slack, [url: "http://example.com"]

… or you can put the webhook URL in the SLACK_LOGGER_WEBHOOK_URL environment variable if you prefer. If you have both the environment variable will be preferred.