Kaynağa Gözat

Fix a bug with how the remaining free space is calculated

pull/27/head
Andrew Thompson 13 yıl önce
ebeveyn
işleme
f43fa83bcc
1 değiştirilmiş dosya ile 7 ekleme ve 7 silme
  1. +7
    -7
      src/lager_format.erl

+ 7
- 7
src/lager_format.erl Dosyayı Görüntüle

@ -145,7 +145,7 @@ build([], Acc, MaxLen, _O) ->
build2([{C,As,F,Ad,P,Pad,Enc}|Cs], Count, MaxLen) ->
{S, Len} = control2(C, As, F, Ad, P, Pad, Enc, MaxLen div Count),
[S|build2(Cs, Count - 1, MaxLen - abs(Len))];
[S|build2(Cs, Count - 1, MaxLen - Len)];
build2([C|Cs], Count, MaxLen) ->
[C|build2(Cs, Count, MaxLen)];
build2([], _, _) -> [].
@ -221,27 +221,27 @@ control(C, A, F, Adj, P, Pad, Enc, L) ->
control2($w, [A], F, Adj, P, Pad, _Enc, L) ->
Term = lager_trunc_io:fprint(A, L, [{lists_as_strings, false}]),
Res = term(Term, F, Adj, P, Pad),
{Res, L - lists:flatlength(Res)};
{Res, lists:flatlength(Res)};
control2($p, [A], F, Adj, P, Pad, _Enc, L) ->
Term = lager_trunc_io:fprint(A, L, [{lists_as_strings, true}]),
Res = term(Term, F, Adj, P, Pad),
{Res, L - lists:flatlength(Res)};
{Res, lists:flatlength(Res)};
control2($W, [A,Depth], F, Adj, P, Pad, _Enc, L) when is_integer(Depth) ->
Term = lager_trunc_io:fprint(A, L, [{depth, Depth}, {lists_as_strings, false}]),
Res = term(Term, F, Adj, P, Pad),
{Res, L - lists:flatlength(Res)};
{Res, lists:flatlength(Res)};
control2($P, [A,Depth], F, Adj, P, Pad, _Enc, L) when is_integer(Depth) ->
Term = lager_trunc_io:fprint(A, L, [{depth, Depth}, {lists_as_strings, true}]),
Res = term(Term, F, Adj, P, Pad),
{Res, L - lists:flatlength(Res)};
{Res, lists:flatlength(Res)};
control2($s, [L0], F, Adj, P, Pad, latin1, L) ->
List = lager_trunc_io:fprint(maybe_flatten(L0), L, [{force_strings, true}]),
Res = string(List, F, Adj, P, Pad),
{Res, L - lists:flatlength(Res)};
{Res, lists:flatlength(Res)};
control2($s, [L0], F, Adj, P, Pad, unicode, L) ->
List = lager_trunc_io:fprint(unicode:characters_to_list(L0), L, [{force_strings, true}]),
Res = uniconv(string(List, F, Adj, P, Pad)),
{Res, L - lists:flatlength(Res)}.
{Res, lists:flatlength(Res)}.
maybe_flatten(X) when is_list(X) ->
lists:flatten(X);

Yükleniyor…
İptal
Kaydet