mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
* src/ejabberd_loglevel.erl: add get/0 API function that returns current log level (EJAB-1004).
SVN Revision: 2426
This commit is contained in:
parent
95239baf85
commit
0cc9d8f8a0
@ -31,7 +31,7 @@
|
|||||||
-module(ejabberd_loglevel).
|
-module(ejabberd_loglevel).
|
||||||
-author('mickael.remond@process-one.net').
|
-author('mickael.remond@process-one.net').
|
||||||
|
|
||||||
-export([set/1]).
|
-export([set/1, get/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
|
||||||
@ -46,6 +46,14 @@
|
|||||||
,{5, debug, "Debug"}
|
,{5, debug, "Debug"}
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
get() ->
|
||||||
|
Level = ejabberd_logger:get(),
|
||||||
|
case lists:keysearch(Level, 1, ?LOG_LEVELS) of
|
||||||
|
{value, Result} -> Result;
|
||||||
|
_ -> erlang:error({no_such_loglevel, Level})
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
set(LogLevel) when is_atom(LogLevel) ->
|
set(LogLevel) when is_atom(LogLevel) ->
|
||||||
set(level_to_integer(LogLevel));
|
set(level_to_integer(LogLevel));
|
||||||
set(Loglevel) when is_integer(Loglevel) ->
|
set(Loglevel) when is_integer(Loglevel) ->
|
||||||
@ -77,7 +85,10 @@ ejabberd_logger_src(Loglevel) ->
|
|||||||
info_msg/4,
|
info_msg/4,
|
||||||
warning_msg/4,
|
warning_msg/4,
|
||||||
error_msg/4,
|
error_msg/4,
|
||||||
critical_msg/4]).
|
critical_msg/4,
|
||||||
|
get/0]).
|
||||||
|
|
||||||
|
get() -> "++ L ++".
|
||||||
|
|
||||||
%% Helper functions
|
%% Helper functions
|
||||||
debug_msg(Module, Line, Format, Args) when " ++ L ++ " >= 5 ->
|
debug_msg(Module, Line, Format, Args) when " ++ L ++ " >= 5 ->
|
||||||
|
Loading…
Reference in New Issue
Block a user