File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 1
1
defmodule ErrorTracker.Filter do
2
2
@ moduledoc """
3
- Behaviour for sanitizing & modifying the saved error context
3
+ Behaviour for sanitizing & modifying the error context before it's saved.
4
+
5
+ defmodule MyApp.ErrorFilter do
6
+ @behaviour ErrorTracker.Filter
7
+
8
+ @impl true
9
+ def sanitize(context) do
10
+ context # Modify the context object (add or remove fields as much as you need.)
11
+ end
12
+ end
13
+
14
+ Once implemented, include it in the ErrorTracker configuration:
15
+
16
+ config :error_tracker, filter: MyApp.Filter
17
+
18
+ With this configuration in place, the ErrorTracker will call `MyApp.Filter.sanitize/1` to get a context before
19
+ saving error occurrence.
20
+
21
+ > #### A note on performance {: .warning}
22
+ >
23
+ > Keep in mind that the `sanitize/1` will be called in the context of the ErrorTracker itself.
24
+ > Slow code will have a significant impact in the ErrorTracker performance. Buggy code can bring
25
+ > the ErrorTracker process down.
26
+ """
27
+
28
+ @ doc """
29
+ This function will be given an error context to inspect/modify before it's saved.
4
30
"""
5
31
@ callback sanitize ( context :: map ( ) ) :: map ( )
6
32
end
You can’t perform that action at this time.
0 commit comments