Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/craigp/slack_logger_backend
An Elixir logger backend for posting errors to Slack.
https://github.com/craigp/slack_logger_backend
elixir logger slack
Last synced: 4 days ago
JSON representation
An Elixir logger backend for posting errors to Slack.
- Host: GitHub
- URL: https://github.com/craigp/slack_logger_backend
- Owner: craigp
- License: mit
- Created: 2016-03-02T10:18:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-06T03:27:54.000Z (over 2 years ago)
- Last Synced: 2025-02-02T14:51:14.833Z (18 days ago)
- Topics: elixir, logger, slack
- Language: Elixir
- Homepage:
- Size: 38.1 KB
- Stars: 33
- Watchers: 3
- Forks: 11
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - A logger backend for posting errors to Slack. (Logging)
- fucking-awesome-elixir - slack_logger_backend - A logger backend for posting errors to Slack. (Logging)
- awesome-elixir - slack_logger_backend - A logger backend for posting errors to Slack. (Logging)
README
slack_logger_backend
====================
[](http://travis-ci.org/craigp/slack_logger_backend)
[](https://coveralls.io/github/craigp/slack_logger_backend?branch=master)
[](https://hex.pm/packages/slack_logger_backend)
[](https://hex.pm/packages/slack_logger_backend)
[](http://inch-ci.org/github/craigp/slack_logger_backend)A logger backend for posting errors to Slack.
You can find the hex package [here](https://hex.pm/packages/slack_logger_backend), and the docs [here](http://hexdocs.pm/slack_logger_backend).
## Usage
First, add the client to your `mix.exs` dependencies:
```elixir
def deps do
[{:slack_logger_backend, "~> 0.0.1"}]
end
```Then run `$ mix do deps.get, compile` to download and compile your dependencies.
Add the `:slack_logger_backend` application as your list of applications in `mix.exs`:
```elixir
def application do
[applications: [:logger, :slack_logger_backend]]
end
```Finally, add `SlackLoggerBackend.Logger` to your list of logging backends in your app's config:
```elixir
config :logger, backends: [SlackLoggerBackend.Logger, :console]
```You can set the log levels you want posted to slack in the config:
```elixir
config SlackLoggerBackend, :levels, [:debug, :info, :warn, :error]
```Alternatively, do both in one step:
```elixir
config :logger, backends: [{SlackLoggerBackend.Logger, :error}]
config :logger, backends: [{SlackLoggerBackend.Logger, [: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:```elixir
config SlackLoggerBackend, :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.