25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Determine the default handlerid at runtime

Apparently Elixir's default is not called 'default'
This commit is contained in:
Badlop 2021-08-03 17:54:49 +02:00
parent 5b0a28bbc9
commit fdfd202a30

View File

@ -288,10 +288,11 @@ start(Level) ->
ConsoleFmtConfig = FmtConfig#{template => console_template()},
try
ok = logger:set_primary_config(level, Level),
ok = logger:update_formatter_config(default, ConsoleFmtConfig),
DefaultHandlerId = get_default_handlerid(),
ok = logger:update_formatter_config(DefaultHandlerId, ConsoleFmtConfig),
case quiet_mode() of
true ->
ok = logger:set_handler_config(default, level, critical);
ok = logger:set_handler_config(DefaultHandlerId, level, critical);
_ ->
ok
end,
@ -319,6 +320,13 @@ start(Level) ->
Err
end.
get_default_handlerid() ->
Ids = logger:get_handler_ids(),
case lists:member(default, Ids) of
true -> default;
false -> hd(Ids)
end.
-spec restart() -> ok.
restart() ->
ok.