Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/riak_logger_config.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

-type config_map() :: any().
-type config_fetch_fun() ::
fun((string(), config_map()) -> list()|pos_integer()).
fun((string(), config_map()) -> list() | infinity | pos_integer()).
-type standard_handler() ::
{handler, atom(), logger_std_h, map()}.

Expand All @@ -36,4 +36,4 @@
-define(DEFAULT_FILTERS_CFGKEY, "logger.default_filters").
-define(ADDITIONAL_HANDLERS_CFGKEY, "logger.additional_handlers").

-define(STANDARD_FILTERS, [crash, error, progress, report, sasl]).
-define(STANDARD_FILTERS, [crash, error, progress, report, sasl]).
2 changes: 1 addition & 1 deletion src/riak_logger.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

{application, riak_logger, [
{description, "Riak Kernel Logger Support"},
{vsn, "1.2.2"},
{vsn, "1.2.3"},
{registered, []},
{applications, [kernel, stdlib]},
{env, []},
Expand Down
18 changes: 12 additions & 6 deletions src/riak_logger_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ conf_getint(Key, ConfFetchFun, Conf) ->
I when erlang:is_integer(I) ->
I
end.
conf_getint_or_infinity(Key, ConfFetchFun, Conf) ->
case ConfFetchFun(Key, Conf) of
infinity -> infinity;
I when erlang:is_integer(I) ->
I
end.

-spec conf_getlist(string(), config_fetch_fun(), config_map()) -> list().
conf_getlist(Key, ConfFetchFun, Conf) ->
Expand All @@ -131,7 +137,7 @@ conf_getatomlist(Key, ConfFetchFun, Conf) ->
list(term()),
list(tuple()),
list(atom()),
pos_integer(),
infinity | pos_integer(),
pos_integer()
}
} | {error, term()}.
Expand Down Expand Up @@ -167,15 +173,15 @@ parse_inputs(ConfFetchFun, Conf) ->
end,
case {
DefaultFilter,
conf_getint(?MAX_FILESIZE_CFGKEY, ConfFetchFun, Conf),
conf_getint_or_infinity(?MAX_FILESIZE_CFGKEY, ConfFetchFun, Conf),
conf_getint(?MAX_FILECOUNT_CFGKEY, ConfFetchFun, Conf)
} of
{{error, Term}, _, _} ->
{error, Term};
{Filter, MaxNumBytes, MaxNumFiles}
when
erlang:is_integer(MaxNumBytes), MaxNumBytes > 0,
erlang:is_integer(MaxNumFiles), MaxNumFiles > 0 ->
((erlang:is_integer(MaxNumBytes) andalso MaxNumBytes > 0) orelse (MaxNumBytes == infinity))
andalso erlang:is_integer(MaxNumFiles) andalso MaxNumFiles > 0 ->
{
ok,
{
Expand Down Expand Up @@ -253,7 +259,7 @@ get_handler(json, ConfFun, Conf, MaxNumBytes, MaxNumFiles, _FormatTerm) ->
).

-spec standard_config(
string(), pos_integer(), pos_integer()) -> #{atom() => any()}.
string(), infinity | pos_integer(), pos_integer()) -> #{atom() => any()}.
standard_config(File, MaxNumBytes, MaxNumFiles) ->
#{
file => File,
Expand Down Expand Up @@ -780,4 +786,4 @@ domain_config_test() ->

?assertMatch(ExpectedHandlers, DomainConfig).

-endif.
-endif.