/envio_log

Logger backend for Envío w/Slack out of the box

Primary LanguageElixir

Envio.Log    Envio.Log

Logger backend for Envío with Slack logging out of the box

Installation

def deps do
  [
    {:envio_log, "~> 0.1"}
  ]
end

Usage

Put this into your config/prod.exs

import Config

config :envio, :log,
  level: :warn,
  process_info: true

config :logger, backends: [Envio.Log.Backend], level: :debug

config :envio, :backends, %{
  Envio.Slack => %{
    {Envio.Log.Publisher, :info} => [
      hook_url: {:system, "YOUR_SLACK_CHANNEL_API_ENDPOINT"}
    ]
  }
}

You are all set! All the calls like:

Logger.warn "Something happened", foo: :bar, answer: 42

will be automatically routed to the configured Slack channel. All the calls to Logger with levels of the less priority than it was configured under :envio, :log, :level key will be purged in compile time.

Documentation.