Skip to content

Metadata :function is not outputted by Logger.Formatter in Elixir 1.15 #12703

Closed
@ronaldwind

Description

@ronaldwind

Elixir and Erlang/OTP versions

Erlang/OTP 26 [erts-14.0.1] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:1] [jit:ns]
Elixir 1.15.0 (compiled with Erlang/OTP 26)

Operating system

Ubuntu 22.04

Current behavior

It seems the special metadata :function is not outputted anymore in Elixir 1.15:

template = Logger.Formatter.compile("\n$time $metadata[$level] $message\n")
 
Logger.Formatter.format(
  %{
    level: :warn, 
    msg: {:string, "foo"}, 
    meta: %{
      mfa: {Logger.Formatter, :compile, 1}
    }
  }, 
  %Logger.Formatter{
    template: template, 
    metadata: [:module, :function, :mfa], 
    utc_log?: true, 
    truncate: 1000, 
    colors: %{enabled: false}
  }
)
|> IO.chardata_to_string()

results in :

"\n10:13:15.268 module=Logger.Formatter mfa=Logger.Formatter.compile/1 [warn] foo\n"

The :module and :mfa are outputted as expected, but the :function missing.

Expected behavior

I expect this output:

"\n10:13:15.268 module=Logger.Formatter function=compile/1 mfa=Logger.Formatter.compile/1 [warn] foo\n"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions