Struggling with Logger.put_process_level

I am not sure if I understand this function correctly.

The docs tell that This will take priority over the primary level set, so it can be used to increase or decrease verbosity of some parts of the running system.

So if my app has the following config config :logger, level: :warning I should be able to log debug message by calling Logger.put_process_level(self(), :debug) right ?

But the following function:

  defp log_error(e, stacktrace) do
    Logger.get_process_level(self()) |> dbg()
    Logger.debug(Exception.format(:error, e, stacktrace))
    Logger.warn("hello")
    Process.sleep(:infinity)
  end

outputs the following:

Logger.get_process_level(self()) #=> :debug

22:19:11.890 [warning] hello

There is no :compile_time_purge_matching option set. If I set always_evaluate_messages: true and change to Logger.debug(Exception.format(:error, e, stacktrace) |> dbg()) I can see the dbg output.

Edit: It seems that logger_config:allow(Level, Module) does not lookup in the process dict at all.

I believe that it is bug in the documentation as currently it isn’t supported AFAIK.

After a quick dug in the erlang logger code it seems indeed. Thanks because I was afraid I missed something.