Skip to content

Add required conditions for Logger's metadata to be print #13777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/logger/lib/logger/formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ defmodule Logger.Formatter do
to the current process. The user can configure the backend to choose
which metadata it wants to print and it will replace the `$metadata`
value.

> #### When is user metadata printed? {: .warning}
>
> User's metadata must meet one of the following conditions to be printed:
> * Be a string (`is_binary/1`)
> * Be a number (either `is_integer/1` or `is_float/1`)
> * Be a PID
> * Be an atom
> * Be a reference
> * Be a port
> * Implement the `String.Chars` protocol
>
> If none of the conditions above are `true`, the given metadata get
> discarded.
"""

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