Преглед на файлове

Merge pull request #192 from basho/adt-fix-empty-binary-printing

Remove the workaround for the bug when printing empty binaries in W mode
pull/193/head
Andrew Thompson преди 11 години
родител
ревизия
da0e4cae00
променени са 3 файла, в които са добавени 8 реда и са изтрити 10 реда
  1. +1
    -1
      rebar.config
  2. +5
    -8
      src/lager_trunc_io.erl
  3. +2
    -1
      src/lager_util.erl

+ 1
- 1
rebar.config Целия файл

@ -1,7 +1,7 @@
{erl_opts, [debug_info, warn_untyped_record]}. {erl_opts, [debug_info, warn_untyped_record]}.
{erl_first_files, ["src/lager_util.erl"]}. {erl_first_files, ["src/lager_util.erl"]}.
{deps, [ {deps, [
{goldrush, ".*",
{goldrush, "0\.1\.6",
{git, "git://github.com/DeadZen/goldrush.git", {tag, "0.1.6"}}} {git, "git://github.com/DeadZen/goldrush.git", {tag, "0.1.6"}}}
]}. ]}.

+ 5
- 8
src/lager_trunc_io.erl Целия файл

@ -127,13 +127,10 @@ print(Atom, _Max, #print_options{force_strings=NoQuote}) when is_atom(Atom) ->
end, end,
{R, length(R)}; {R, length(R)};
print(Bin, _Max, O = #print_options{depth=1}) when is_binary(Bin) ->
case O#print_options.lists_as_strings of
true when Bin == <<>> ->
{"<<>>", 4};
_ ->
{"<<...>>", 7}
end;
print(<<>>, _Max, #print_options{depth=1}) ->
{"<<>>", 4};
print(Bin, _Max, #print_options{depth=1}) when is_binary(Bin) ->
{"<<...>>", 7};
print(<<>>, _Max, Options) -> print(<<>>, _Max, Options) ->
case Options#print_options.force_strings of case Options#print_options.force_strings of
true -> true ->
@ -766,7 +763,7 @@ depth_limit_test() ->
%% I don't even know... %% I don't even know...
?assertEqual("<<>>", lists:flatten(format("~P", [<<>>, 1], 50))), ?assertEqual("<<>>", lists:flatten(format("~P", [<<>>, 1], 50))),
?assertEqual("<<...>>", lists:flatten(format("~W", [<<>>, 1], 50))),
?assertEqual("<<>>", lists:flatten(format("~W", [<<>>, 1], 50))),
?assertEqual("{abc,<<\"abc\\\"\">>}", lists:flatten(format("~P", [{abc,<<"abc\"">>}, 4], 50))), ?assertEqual("{abc,<<\"abc\\\"\">>}", lists:flatten(format("~P", [{abc,<<"abc\"">>}, 4], 50))),

+ 2
- 1
src/lager_util.erl Целия файл

@ -587,6 +587,7 @@ rotate_file_fail_test() ->
ok. ok.
check_trace_test() -> check_trace_test() ->
lager:start(),
trace_filter(none), trace_filter(none),
%% match by module %% match by module
?assertEqual([foo], check_traces([{module, ?MODULE}], ?EMERGENCY, [ ?assertEqual([foo], check_traces([{module, ?MODULE}], ?EMERGENCY, [
@ -627,7 +628,7 @@ check_trace_test() ->
{[{module, '*'}], config_to_mask('!=info'), anythingbutinfo}, {[{module, '*'}], config_to_mask('!=info'), anythingbutinfo},
{[{module, '*'}], config_to_mask('!=notice'), anythingbutnotice} {[{module, '*'}], config_to_mask('!=notice'), anythingbutnotice}
], [])), ], [])),
application:stop(lager),
ok. ok.
is_loggable_test_() -> is_loggable_test_() ->

Зареждане…
Отказ
Запис