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

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

merged 3 commits into from
Aug 12, 2024

Conversation

Krapaince
Copy link
Contributor

Addresses #13772

@@ -74,6 +74,18 @@ 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.

> #### Disclaimer {: .warning}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> #### Disclaimer {: .warning}
> #### When is user metadata printed? {: .warning}

Comment on lines 81 to 82
> * Be a string (match with the `is_binary/1` guard)
> * Be a number (either match with the `is_integer/1` or `is_float/1` guard)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> * Be a string (match with the `is_binary/1` guard)
> * Be a number (either match with the `is_integer/1` or `is_float/1` guard)
> * Be a string (`is_binary/1`)
> * Be a number (either `is_integer/1` or `is_float/1`)

> User's metadata must meet one of the following conditions to be printed:
> * Be a string (match with the `is_binary/1` guard)
> * Be a number (either match with the `is_integer/1` or `is_float/1` guard)
> * Be a pid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> * Be a pid
> * Be a PID

> * Be a reference
> * Be a port
> * Implement the `String.Chars` protocol
> otherwise the given metadata will be discarded.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> otherwise the given metadata will be discarded.
>
> If none of the conditions above are true, the given metadata gets discarded.

@whatyouhide whatyouhide changed the title Add required conditions for Logger's metadata to be print. Add required conditions for Logger's metadata to be print Aug 12, 2024
@josevalim josevalim merged commit db72cdd into elixir-lang:main Aug 12, 2024
8 of 9 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants