]> granicus.if.org Git - ejabberd/commitdiff
Avoid calling to logger module on OTP<22
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Fri, 25 Oct 2019 12:27:47 +0000 (15:27 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Fri, 25 Oct 2019 12:27:47 +0000 (15:27 +0300)
src/ejabberd_ctl.erl
src/ejabberd_logger.erl
src/ejabberd_option.erl
src/ejabberd_options.erl

index 76a028389940fe24103a1132bfea776a66c06bf9..dfc5ca9e7e7eebb5ad6322ff180153333106627a 100644 (file)
@@ -68,7 +68,7 @@
 %%-----------------------------
 
 start() ->
-    logger:set_primary_config(level, none),
+    disable_logging(),
     [SNode, Timeout, Args] = case init:get_plain_arguments() of
                                  [SNode2, "--no-timeout" | Args2] ->
                                      [SNode2, infinity, Args2];
@@ -865,6 +865,14 @@ format_usage_tuple([ElementDef | ElementsDef], Indentation) ->
 print(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
 %%-----------------------------
index 211099720806b56e625502342ada1e5ad45530bc..2a8c1a199b0f82fa2aaa1dbb55aaa614a65f1be3 100644 (file)
@@ -45,6 +45,8 @@
         or (L == critical) or (L == error) or (L == warning)
         or (L == notice) or (L == info) or (L == debug))).
 
+-export_type([loglevel/0]).
+
 -spec restart() -> ok.
 -spec reopen_log() -> ok.
 -spec rotate_log() -> ok.
index d9721ab1f36ca3405e3ad1ca3405a22ac0375cf9..fde41e78d37a3ce52498538e313ecfeb2698ff2f 100644 (file)
@@ -562,7 +562,7 @@ log_rotate_count() ->
 log_rotate_size() ->
     ejabberd_config:get_option({log_rotate_size, global}).
 
--spec loglevel() -> 'none' | logger:level().
+-spec loglevel() -> ejabberd_logger:loglevel().
 loglevel() ->
     ejabberd_config:get_option({loglevel, global}).
 
index e95ac878d65148bb98ece62c60cd9bf366d4f522..eacde998d05af4f8a67ba3ba87d21aa81cdf8d91 100644 (file)
@@ -425,7 +425,7 @@ opt_type(jwt_auth_only_rule) ->
                    {websocket_origin, [binary()]} |
                    {disable_sasl_mechanisms, [binary()]} |
                    {s2s_zlib, boolean()} |
-                   {loglevel, none | logger:level()} |
+                   {loglevel, ejabberd_logger:loglevel()} |
                    {listen, [ejabberd_listener:listener()]} |
                    {modules, [{module(), gen_mod:opts(), integer()}]} |
                    {ldap_uids, [{binary(), binary()}]} |