diff --git a/src/lager_transform.erl b/src/lager_transform.erl index 5eaa544..8927610 100644 --- a/src/lager_transform.erl +++ b/src/lager_transform.erl @@ -29,7 +29,6 @@ %% @private parse_transform(AST, _Options) -> - %io:format("~n~p~n", [AST]), walk_ast([], AST). walk_ast(Acc, []) -> @@ -58,8 +57,6 @@ transform_statement({call, Line, {remote, Line1, {atom, Line2, lager}, {atom, Line3, Severity}}, Arguments} = Stmt) -> case lists:member(Severity, ?LEVELS) of true -> - %io:format("call to lager ~p on line ~p in function ~p in module ~p~n", - %[Severity, Line, get(function), get(module)]), %% a case to check the mochiglobal 'loglevel' key against the %% message we're trying to log {'case',Line, @@ -89,7 +86,6 @@ transform_statement({call, Line, {remote, Line1, {atom, Line2, lager}, %% No, don't log {clause,Line3,[{var,Line3,'_'}],[],[{atom,Line3,ok}]}]}; false -> - %io:format("skipping non-log lager call ~p~n", [Severity]), Stmt end; transform_statement({call, Line, {remote, Line1, {atom, Line2, boston_lager}, @@ -106,7 +102,6 @@ transform_statement(Stmt) when is_tuple(Stmt) -> transform_statement(Stmt) when is_list(Stmt) -> [transform_statement(S) || S <- Stmt]; transform_statement(Stmt) -> - %io:format("Statement ~p~n", [Stmt]), Stmt. diff --git a/src/lager_trunc_io.erl b/src/lager_trunc_io.erl index 0d8298f..77e2d51 100644 --- a/src/lager_trunc_io.erl +++ b/src/lager_trunc_io.erl @@ -99,12 +99,9 @@ format([[$~|H]| T], [AH | AT], Max, Acc, ArgAcc) when length(H) == 1 -> format(T, AT, Max, [[$~ | H] | Acc], [AH | ArgAcc]) end; format([[$~|H]| T], [AH | AT], Max, Acc, ArgAcc) -> - % complicated format specifier, gonna have to parse it.. - %case re:run(H, "^(?:-??(\\d+|\\*)\\.|\\.|)(?:-??(\\d+|\\*)\\.|\\.|)(-??.|)(t|)([cfegswpWPBX#bx+ni])$", [{capture, all_but_first, list}]) of - %% its actually simpler to just look at the last character in the string + %% its actually simplest to just look at the last character in the string case lists:nth(length(H), H) of C when C == $p; C == $w; C == $s -> - %{match, [_F, _P, _Pad, _Mod, C]} when C == "p"; C=="w"; C=="s" -> %okay, these are prime candidates for rewriting case print(AH, Max + length(H) + 1) of {_Res, Max} -> @@ -122,7 +119,6 @@ format([[$~|H]| T], [AH | AT], Max, Acc, ArgAcc) -> format(T, AT, Max + length(H) + 1 - RealLen, ["~s" | Acc], [Value | ArgAcc]) end; C when C == $P; C == $W -> - %{match, [_F, _P, _Pad, _Mod, C]} when C == "P"; C == "W" -> %% ~P and ~W consume 2 arguments, the second one being a depth limiter. %% trunc_io isn't (yet) depth aware, so we can't honor this format string %% safely at the moment, so just treat it like a regular ~p @@ -137,15 +133,11 @@ format([[$~|H]| T], [AH | AT], Max, Acc, ArgAcc) -> format(T, AT2, Max + 2 - Length, ["~s" | Acc], [String | ArgAcc]) end; C when C == $X; C == $x -> - %{match, [_F, _P, _Pad, _Mod, C]} when C == "X"; C == "x" -> %% ~X consumes 2 arguments. It only prints integers so we can leave it alone [AH2 | AT2] = AT, format(T, AT2, Max, [[$~|H]|Acc], [AH2, AH |ArgAcc]); _ -> format(T, AT, Max, [[$~|H] | Acc], [AH|ArgAcc]) - %nomatch -> - %io:format("unable to match format pattern ~~~p~n", [H]), - %format(T, AT, Max, [[$~|H] | Acc], [AH|ArgAcc]) end; format([H | T], Args, Max, Acc, ArgAcc) -> format(T, Args, Max, [H | Acc], ArgAcc).