Skip to content

Commit db72cdd

Browse files
authored
Add required conditions for Logger's metadata to be print (#13777)
1 parent 02a1f07 commit db72cdd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/logger/lib/logger/formatter.ex

+15
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ defmodule Logger.Formatter do
7474
to the current process. The user can configure the backend to choose
7575
which metadata it wants to print and it will replace the `$metadata`
7676
value.
77+
78+
> #### When is user metadata printed? {: .warning}
79+
>
80+
> User's metadata must meet one of the following conditions to be printed:
81+
>
82+
> * Be a string (`is_binary/1`)
83+
> * Be a number (either `is_integer/1` or `is_float/1`)
84+
> * Be a PID
85+
> * Be an atom
86+
> * Be a reference
87+
> * Be a port
88+
> * Implement the `String.Chars` protocol
89+
>
90+
> If none of the conditions above are `true`, the given metadata get
91+
> discarded.
7792
"""
7893

7994
@type date :: {1970..10000, 1..12, 1..31}

0 commit comments

Comments
 (0)