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

Move opt_type/1 function out of if-else block

This commit is contained in:
Evgeniy Khramtsov 2015-06-03 15:52:19 +03:00
parent 730fd55ec9
commit ab196b4b02

View File

@ -63,6 +63,17 @@ get_log_path() ->
end end
end. end.
opt_type(log_rotate_date) ->
fun(S) -> binary_to_list(iolist_to_binary(S)) end;
opt_type(log_rotate_size) ->
fun(I) when is_integer(I), I >= 0 -> I end;
opt_type(log_rotate_count) ->
fun(I) when is_integer(I), I >= 0 -> I end;
opt_type(log_rate_limit) ->
fun(I) when is_integer(I), I >= 0 -> I end;
opt_type(_) ->
[log_rotate_date, log_rotate_size, log_rotate_count, log_rate_limit].
-ifdef(LAGER). -ifdef(LAGER).
get_integer_env(Name, Default) -> get_integer_env(Name, Default) ->
@ -186,17 +197,6 @@ get() ->
set(LogLevel) -> set(LogLevel) ->
p1_loglevel:set(LogLevel). p1_loglevel:set(LogLevel).
opt_type(log_rotate_date) ->
fun(S) -> binary_to_list(iolist_to_binary(S)) end;
opt_type(log_rotate_size) ->
fun(I) when is_integer(I), I >= 0 -> I end;
opt_type(log_rotate_count) ->
fun(I) when is_integer(I), I >= 0 -> I end;
opt_type(log_rate_limit) ->
fun(I) when is_integer(I), I >= 0 -> I end;
opt_type(_) ->
[log_rotate_date, log_rotate_size, log_rotate_count, log_rate_limit].
%%%=================================================================== %%%===================================================================
%%% Internal functions %%% Internal functions
%%%=================================================================== %%%===================================================================