Skip to content

Commit

Permalink
docs: also document config options for hexdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Feb 12, 2025
1 parent cfcdf62 commit 15b4269
Showing 1 changed file with 70 additions and 1 deletion.
71 changes: 70 additions & 1 deletion lib/tower.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ defmodule Tower do
- [`tower_rollbar`](https://hexdocs.pm/tower_rollbar)
- [`tower_sentry`](https://hexdocs.pm/tower_sentry)
- [`tower_slack`](https://hexdocs.pm/tower_slack)
- more coming...
## Motivation
Expand Down Expand Up @@ -199,6 +198,76 @@ defmodule Tower do
# in some config/*.exs
config :tower, reporters: [MyApp.ErrorReporter]
## Configuration
### `reporters`
List of reporters Tower should report events to.
Default: `[Tower.EphemeralReporter]`
Example:
```elixir
config :tower, reporters: [TowerEmail]
```
### `log_level`
`Logger` messages this level and above will be reported.
Possible values are any of defined `Logger` levels (https://hexdocs.pm/logger/Logger.html#module-levels) or
`:none` to disable reporting of `Logger` messages.
Default: `:critical`
Example:
```elixir
config :tower, log_level: :error
```
### `ignored_exceptions`
List of exceptions that Tower should ignore and not report.
Default: `[]`
Example:
```elixir
config :tower, ignored_exceptions: [DBConnection.ConnectionError]
```
### `logger_metadata`
List of keys that Tower should pick up from the current process `Logger.metadata` when reporting events.
Default: `[]`
Example:
A common use case is setting `Logger.metadata(user_id: user.id)` at the start of your plugs or controller actions and
configure Tower:
```elixir
config :tower, logger_metadata: [:user_id]
```
so that it's included in the reported exception or message event as extra metadata.
Also if using Phoenix you can
```elixir
config :tower, logger_metadata: [:request_id]
```
so that you can co-relate your exceptions reports to the request id in your application logs.
More about Logger metadata:
- https://hexdocs.pm/logger/Logger.html#module-metadata
- https://hexdocs.pm/logger/Logger.html#metadata/1
"""

defmodule ReportEventError do
Expand Down

0 comments on commit 15b4269

Please sign in to comment.