Skip to content

Commit

Permalink
feat: simplifies reporter config UX
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Sep 30, 2024
1 parent b31ad05 commit 23b6d67
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ config(
:reporters,
[
# along any other possible reporters
TowerErrorTracker.Reporter
TowerErrorTracker
]
)
```
Expand Down
18 changes: 8 additions & 10 deletions lib/tower_error_tracker.ex
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
defmodule TowerErrorTracker do
@moduledoc """
Documentation for `TowerErrorTracker`.
"""
The module that needs to be added to the list of Tower reporters.
@doc """
Hello world.
## Example
## Examples
config :tower, :reporters, [TowerErroTracker]
"""

iex> TowerErrorTracker.hello()
:world
@behaviour Tower.Reporter

"""
def hello do
:world
@impl true
def report_event(event) do
TowerErrorTracker.Reporter.report_event(event)
end
end
11 changes: 1 addition & 10 deletions lib/tower_error_tracker/reporter.ex
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
defmodule TowerErrorTracker.Reporter do
@moduledoc """
The reporter module that needs to be added to the list of Tower reporters.
@moduledoc false

## Example
config :tower, :reporters, [TowerErroTracker.Reporter]
"""

@behaviour Tower.Reporter

@impl true
def report_event(%Tower.Event{
kind: :error,
reason: exception,
Expand Down
2 changes: 1 addition & 1 deletion test/tower_error_tracker_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule TowerErrorTrackerTest do
Ecto.Migrator.up(TestApp.Repo, 0, TestApp.Repo.Migrations.AddErrorTracker)
end)

Application.put_env(:tower, :reporters, [TowerErrorTracker.Reporter])
Application.put_env(:tower, :reporters, [TowerErrorTracker])
Tower.attach()

on_exit(fn ->
Expand Down

0 comments on commit 23b6d67

Please sign in to comment.