From: Evgeniy Khramtsov Date: Wed, 3 Jun 2015 12:52:19 +0000 (+0300) Subject: Move opt_type/1 function out of if-else block X-Git-Tag: 15.06~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab196b4b02ac2cbe7114ecb466cc10aea55bc112;p=ejabberd Move opt_type/1 function out of if-else block --- diff --git a/src/ejabberd_logger.erl b/src/ejabberd_logger.erl index 8c13be07f..3bfe37c80 100644 --- a/src/ejabberd_logger.erl +++ b/src/ejabberd_logger.erl @@ -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 %%%===================================================================