mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Document ejabberd_loglevel using EDoc (EJAB-225)
This commit is contained in:
parent
abdbb347eb
commit
864b0ec149
@ -63,9 +63,15 @@
|
||||
#loglevel{ordinal = 5, name = debug, description = "Debug",
|
||||
function = debug_msg, event_type = info_msg, msg_prefix = "D"}]).
|
||||
|
||||
%% @type level() = integer() | atom().
|
||||
|
||||
%% @spec () -> [LevelOrdinal::integer(), [{Module::atom(), LevelOrdinal::integer()}]]
|
||||
%% @doc Get the default and all custom levels
|
||||
get() ->
|
||||
ejabberd_logger:get().
|
||||
|
||||
%% @spec () -> {Ordinal::integer(), Name::atom(), Description::string()}
|
||||
%% @doc Get the default level
|
||||
get_default() ->
|
||||
{DefaultLevel, _CustomLevels} = ejabberd_logger:get(),
|
||||
case lists:keysearch(DefaultLevel, #loglevel.ordinal, ?LOG_LEVELS) of
|
||||
@ -75,6 +81,9 @@ get_default() ->
|
||||
erlang:error({no_such_loglevel, DefaultLevel})
|
||||
end.
|
||||
|
||||
%% @spec (DefaultLevel::level() | {DefaultLevel::level(), [{Module::atom(), Level::level()]}) ->
|
||||
%% {module, ejabberd_logger}
|
||||
%% @doc Set the default and all custom levels
|
||||
set(DefaultLevel) when is_atom(DefaultLevel) orelse is_integer(DefaultLevel) ->
|
||||
set({DefaultLevel, []});
|
||||
set({DefaultLevel, CustomLevels}) when is_list(CustomLevels) ->
|
||||
@ -90,6 +99,8 @@ set({DefaultLevel, CustomLevels}) when is_list(CustomLevels) ->
|
||||
set(_) ->
|
||||
exit("Invalid loglevel format").
|
||||
|
||||
%% @spec (Module::atom()::atom(), CustomLevel::level()) -> ok
|
||||
%% @doc Set a custom level
|
||||
set_custom(Module, Level) ->
|
||||
{DefaultLevel, CustomLevels} = ejabberd_logger:get(),
|
||||
case lists:keysearch(Module, 1, CustomLevels) of
|
||||
@ -101,10 +112,14 @@ set_custom(Module, Level) ->
|
||||
set({DefaultLevel, [{Module, Level} | CustomLevels]})
|
||||
end.
|
||||
|
||||
%% @spec () -> ok
|
||||
%% @doc Clear all custom levels
|
||||
clear_custom() ->
|
||||
{DefaultLevel, _CustomLevels} = ejabberd_logger:get(),
|
||||
set({DefaultLevel, []}).
|
||||
|
||||
%% @spec (Module::atom()) -> ok
|
||||
%% @doc Clear a custom level
|
||||
clear_custom(Module) ->
|
||||
{DefaultLevel, CustomLevels} = ejabberd_logger:get(),
|
||||
case lists:keysearch(Module, 1, CustomLevels) of
|
||||
|
Loading…
Reference in New Issue
Block a user