25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Avoid calling to logger module on OTP<22

This commit is contained in:
Evgeny Khramtsov 2019-10-25 15:27:47 +03:00
parent 516950fb1e
commit f1a35cc9ac
4 changed files with 13 additions and 3 deletions

View File

@ -68,7 +68,7 @@
%%----------------------------- %%-----------------------------
start() -> start() ->
logger:set_primary_config(level, none), disable_logging(),
[SNode, Timeout, Args] = case init:get_plain_arguments() of [SNode, Timeout, Args] = case init:get_plain_arguments() of
[SNode2, "--no-timeout" | Args2] -> [SNode2, "--no-timeout" | Args2] ->
[SNode2, infinity, Args2]; [SNode2, infinity, Args2];
@ -865,6 +865,14 @@ format_usage_tuple([ElementDef | ElementsDef], Indentation) ->
print(Format, Args) -> print(Format, Args) ->
io:format(lists:flatten(Format), Args). io:format(lists:flatten(Format), Args).
-ifdef(LAGER).
disable_logging() ->
ok.
-else.
disable_logging() ->
logger:set_primary_config(level, none).
-endif.
%%----------------------------- %%-----------------------------
%% Command management %% Command management
%%----------------------------- %%-----------------------------

View File

@ -45,6 +45,8 @@
or (L == critical) or (L == error) or (L == warning) or (L == critical) or (L == error) or (L == warning)
or (L == notice) or (L == info) or (L == debug))). or (L == notice) or (L == info) or (L == debug))).
-export_type([loglevel/0]).
-spec restart() -> ok. -spec restart() -> ok.
-spec reopen_log() -> ok. -spec reopen_log() -> ok.
-spec rotate_log() -> ok. -spec rotate_log() -> ok.

View File

@ -562,7 +562,7 @@ log_rotate_count() ->
log_rotate_size() -> log_rotate_size() ->
ejabberd_config:get_option({log_rotate_size, global}). ejabberd_config:get_option({log_rotate_size, global}).
-spec loglevel() -> 'none' | logger:level(). -spec loglevel() -> ejabberd_logger:loglevel().
loglevel() -> loglevel() ->
ejabberd_config:get_option({loglevel, global}). ejabberd_config:get_option({loglevel, global}).

View File

@ -425,7 +425,7 @@ opt_type(jwt_auth_only_rule) ->
{websocket_origin, [binary()]} | {websocket_origin, [binary()]} |
{disable_sasl_mechanisms, [binary()]} | {disable_sasl_mechanisms, [binary()]} |
{s2s_zlib, boolean()} | {s2s_zlib, boolean()} |
{loglevel, none | logger:level()} | {loglevel, ejabberd_logger:loglevel()} |
{listen, [ejabberd_listener:listener()]} | {listen, [ejabberd_listener:listener()]} |
{modules, [{module(), gen_mod:opts(), integer()}]} | {modules, [{module(), gen_mod:opts(), integer()}]} |
{ldap_uids, [{binary(), binary()}]} | {ldap_uids, [{binary(), binary()}]} |