What am I missing here? I think I’ve read the doc multiple times without success. I’ve even tried to follow the Logger's code which just seem to confirm my first understanding.
Thank you in advance for your help, it will be much appreciated
According to Logger — Logger v1.16.0, the only pre-defined metadata keys are :application, :module, :function, :file, :line. You specify :all in your example, which has no special meaning and is treated as a regular key. So this would work:
Well, in the console back end code I’ve found this:
defp format_event(level, msg, ts, md, state) do
%{format: format, metadata: keys, colors: colors} = state
format
|> Logger.Formatter.format(level, msg, ts, take_metadata(md, keys))
|> color_event(level, colors, md)
end
defp take_metadata(metadata, :all), do: metadata
defp take_metadata(metadata, keys) do
Enum.reduce keys, [], fn key, acc ->
case Keyword.fetch(metadata, key) do
{:ok, val} -> [{key, val} | acc]
:error -> acc
end
end
end
Which seems to allow to output all metadata, without filtering, which is my purpose here. I want any metadata passed to the Logger.debug to be appended to the output. Not just some keys provided in the logger’s back end config.
That’s it! That’s the point I missed. Thank you @pma. For the time being I’m stuck with Elixir 1.4.2. The fact is that I’ve been looking for something like the :all keyword to be able to log any meta data provided in the Logger.debug. Because, without any configuration, the back end seems to refuse to output them.