Skip to content

mimiquate/tower_slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TowerSlack

ci Hex.pm Documentation

Error tracking and reporting to Slack.

A simple post-to-Slack reporter for Tower error handler.

Installation

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

# mix.exs

def deps do
  [
    {:tower_slack, "~> 0.4.0"}
  ]
end

Usage

First, Tower error handler must be attached.

# lib/<your_app>/application.ex

defmodule YourApp.Application do
  def start(_type, _args) do
    Tower.attach()

    # rest of your code
  end

Then you register the reporter with Tower.

# config/config.exs

config(
  :tower,
  :reporters,
  [
    # along any other possible reporters
    TowerSlack.Reporter
  ]
)

And make any additional configurations specific to this reporter.

# config/runtime.exs

config :tower_slack,
  otp_app: :your_app,
  webhook_url: System.get_env("TOWER_SLACK_WEBHOOK_URL"),
  environment: System.get_env("DEPLOYMENT_ENV", to_string(config_env()))

Instructions to create the Slack Webhook URL in https://api.slack.com/messaging/webhooks.

License

Copyright 2024 Mimiquate

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.