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
1 changed files with 11 additions and 11 deletions

View File

@ -63,6 +63,17 @@ get_log_path() ->
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).
get_integer_env(Name, Default) ->
@ -186,17 +197,6 @@ get() ->
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
%%%===================================================================