Skip to content

Commit a31118e

Browse files
authored
Use Logger.add_backend/1
Configuring the backend on config/config.exs may be too early and cause issues if trying to loading logger config before Sentry is compiled. Or it can be an issue in umbrella projects when only some of them depend on Sentry.
1 parent 218aa3b commit a31118e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ defmodule MyAppWeb.ErrorView do
9393

9494
### Capture Crashed Process Exceptions
9595

96-
This library comes with an extension to capture all error messages that the Plug handler might not. This is based on [Logger.Backend](https://hexdocs.pm/logger/Logger.html#module-backends).
96+
This library comes with an extension to capture all error messages that the Plug handler might not. This is based on [Logger.Backend](https://hexdocs.pm/logger/Logger.html#module-backends). You can add it as a backend when your application starts:
9797

9898
```diff
99-
# config/config.exs
99+
# lib/my_app/application.ex
100100

101-
+ config :logger,
102-
+ backends: [:console, Sentry.LoggerBackend]
101+
+ def start(_type, _args) do
102+
+ Logger.add_backend(Sentry.LoggerBackend)
103103
```
104104

105105
The backend can also be configured to capture Logger metadata, which is detailed [here](https://hexdocs.pm/sentry/Sentry.LoggerBackend.html).

0 commit comments

Comments
 (0)