Fix regression in Logger :metadata
config
#13546
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When upgrading Elixir from 1.14 to 1.16 in our Phoenix app the project fails to start when Logger exits due to an argument error in the
Enum.into/2
call inlogger/app.ex
when reading in the values from config.The Logger documentation describes the
metadata
property of the config as a list of atoms.Enum.into/2
onlogger/app.ex:40
fails when reading this structure in as it expects a keyword list it can convert to map.Looking at
logger_test.exs
from the PR where theEnum.into/2
call was added shows that the test is setting the metadata config as a keyword listThis patch uses
Enum.into/3
to handle both cases with a transform, defaulting to:yes
as the value when receiving a list of atoms as described throughout the Logger docs.