Skip to content

azohra/quack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quack

Hex pm GitHub license

A simple, yet beautiful, Elixir Logger backend for Slack

Installation

The package can be installed by adding quack to your list of dependencies in mix.exs:

def deps do
  [
    {:quack, "~> 0.1.1"}
  ]
end

Then add Quack to your list of extra applications:

  def application do
    [
      mod: {MyApplication, []},
      extra_applications: [:logger, :quack]
    ]
  end

Configuration

Configure the Slack incoming webhook:

  config :quack, webhook_url: "https://hooks.slack.com/services/...."

Configure your Logger application to use Quack as a backend:

  config :logger, backends: [:console, Quack.Logger]

Configure the minimum-level of logs you want exported to Slack:

  # Options are [:debug, :info, :warn, :error]
  config :quack, level: :debug

Configure which metadata you want to report on:

  # You can specify a list of containing these fields: 
  #   [
  #     :application,
  #     :module,
  #     :function,
  #     :file,
  #     :line,
  #     :pid,
  #     :crash_reason,
  #     :initial_call,
  #     :registered_name
  #   ]

  config :quack, meta: [:file, :function, :line]

  # Or you can specify absolutes such as :all, or :none
  config :quack, meta: :none

The complete configuration should look something like this:

  config :quack,
    level: :info,
    meta: [:file, :function, :line],
    webhook_url: "https://hooks.slack.com/services/..."

  config :logger, backends: [:console, Quack.Logger]

Examples

debug message info message warning message error message