TowerDB
A Tower reporter that stores errors and exceptions in a PostgreSQL database using Ecto.
Installation
Add tower_db to your list of dependencies in mix.exs:
def deps do
[
{:tower_db, "~> 0.6.0"}
]
end
Then fetch the dependencies:
mix deps.get
Setup
Add TowerDB to your Tower reporters:
# config/config.exs
config :tower, reporters: [TowerDB]
Configure the Ecto repo that TowerDB will use to store events:
config :tower_db, repo: MyApp.Repo
TowerDB requires database tables to store error events. Generate an Ecto migration:
mix ecto.gen.migration add_tower_db
If you want to use a repo different from MyApp.Repo as its primary repo, specify it with the -r flag:
mix ecto.gen.migration add_tower_db -r MyApp.SecondaryRepo
Then add the following content to the generated migration file:
defmodule MyApp.Repo.Migrations.AddTowerDB do
use Ecto.Migration
def up, do: TowerDB.Migration.up(from: 0, to: 5)
def down, do: TowerDB.Migration.down(from: 5, to: 0)
end
Run the migration:
mix ecto.migrate
License
See LICENSE.