25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

Use proper format depending on the formatter (#4256)

This fixes recent commmit 090a8e3
This commit is contained in:
Badlop 2024-07-15 13:42:44 +02:00
parent c013a59d16
commit 9bd6b11007

View File

@ -370,7 +370,16 @@ console_template() ->
andalso
'Elixir.System':version() >= <<"1.15">> of
true ->
[date, " ", time, " [", level, "] ", msg, "\n"];
{ok, DC} = logger:get_handler_config(default),
MessageFormat = case maps:get(formatter, DC) of
%% https://hexdocs.pm/logger/1.17.2/Logger.Formatter.html#module-formatting
{'Elixir.Logger.Formatter', _} ->
message;
%% https://www.erlang.org/doc/apps/kernel/logger_formatter#t:template/0
{logger_formatter, _} ->
msg
end,
[date, " ", time, " [", level, "] ", MessageFormat, "\n"];
false ->
[time, " [", level, "] " | msg()]
end.