From 9bd6b110077e98d8d6f82b2e14742b69b98135de Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 15 Jul 2024 13:42:44 +0200 Subject: [PATCH] Use proper format depending on the formatter (#4256) This fixes recent commmit 090a8e3 --- src/ejabberd_logger.erl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ejabberd_logger.erl b/src/ejabberd_logger.erl index f2fd7b3d7..3189860fc 100644 --- a/src/ejabberd_logger.erl +++ b/src/ejabberd_logger.erl @@ -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.