Skip to content
Browse files

Rename trunc_io to lager_trunc_io to prevent clashes

  • Loading branch information...
1 parent de705e4 commit 4ac01374fa6ca5378327b86b1ac43fd097e70880 @Vagabond Vagabond committed Jul 8, 2011
View
4 src/error_logger_lager_h.erl
@@ -188,7 +188,7 @@ format_reason({system_limit, [{M, F, _}|_] = Trace}) ->
{erlang, list_to_atom} ->
"tried to create an atom larger than 255, or maximum atom count exceeded";
_ ->
- {Str, _} = trunc_io:print(Trace, 500),
+ {Str, _} = lager_trunc_io:print(Trace, 500),
Str
end,
["system limit: ", Limit];
@@ -208,7 +208,7 @@ format_reason({noproc, MFA}) ->
format_reason({{badfun, Term}, [MFA|_]}) ->
[io_lib:format("bad function ~w in ", [Term]), format_mfa(MFA)];
format_reason(Reason) ->
- {Str, _} = trunc_io:print(Reason, 500),
+ {Str, _} = lager_trunc_io:print(Reason, 500),
Str.
format_mfa({M, F, A}) when is_list(A) ->
View
10 src/lager_crash_log.erl
@@ -128,10 +128,10 @@ code_change(_OldVsn, State, _Extra) ->
%% to limit the formatted string's size.
limited_fmt(Fmt, Args, FmtMaxBytes) ->
- trunc_io:format(Fmt, Args, FmtMaxBytes).
+ lager_trunc_io:format(Fmt, Args, FmtMaxBytes).
limited_str(Term, FmtMaxBytes) ->
- {Str, _} = trunc_io:print(Term, FmtMaxBytes),
+ {Str, _} = lager_trunc_io:print(Term, FmtMaxBytes),
Str.
other_node_suffix(Pid) when node(Pid) =/= node() ->
@@ -172,12 +172,12 @@ sasl_limited_str(supervisor_report, Report, FmtMaxBytes) ->
Offender = lager_stdlib:sup_get(offender, Report),
FmtString = " Supervisor: ~p~n Context: ~p~n Reason: "
"~s~n Offender: ~s~n~n",
- {ReasonStr, _} = trunc_io:print(Reason, FmtMaxBytes),
- {OffenderStr, _} = trunc_io:print(Offender, FmtMaxBytes),
+ {ReasonStr, _} = lager_trunc_io:print(Reason, FmtMaxBytes),
+ {OffenderStr, _} = lager_trunc_io:print(Offender, FmtMaxBytes),
io_lib:format(FmtString, [Name, Context, ReasonStr, OffenderStr]);
sasl_limited_str(progress, Report, FmtMaxBytes) ->
[begin
- {Str, _} = trunc_io:print(Data, FmtMaxBytes),
+ {Str, _} = lager_trunc_io:print(Data, FmtMaxBytes),
io_lib:format(" ~16w: ~s~n", [Tag, Str])
end || {Tag, Data} <- Report];
sasl_limited_str(crash_report, Report, FmtMaxBytes) ->
View
6 src/lager_stdlib.erl
@@ -153,7 +153,7 @@ proc_lib_format([OwnReport,LinkReport], FmtMaxBytes) ->
format_report(Rep, FmtMaxBytes) when is_list(Rep) ->
format_rep(Rep, FmtMaxBytes);
format_report(Rep, FmtMaxBytes) ->
- {Str, _} = trunc_io:print(Rep, FmtMaxBytes),
+ {Str, _} = lager_trunc_io:print(Rep, FmtMaxBytes),
io_lib:format("~p~n", [Str]).
format_rep([{initial_call,InitialCall}|Rep], FmtMaxBytes) ->
@@ -185,12 +185,12 @@ format_mfa({M,F,Args}=StartF, FmtMaxBytes) ->
pp_fun(FmtMaxBytes) ->
fun(Term, _I) ->
- {Str, _} = trunc_io:print(Term, FmtMaxBytes),
+ {Str, _} = lager_trunc_io:print(Term, FmtMaxBytes),
io_lib:format("~s", [Str])
end.
format_tag(Tag, Data, FmtMaxBytes) ->
- {Str, _} = trunc_io:print(Data, FmtMaxBytes),
+ {Str, _} = lager_trunc_io:print(Data, FmtMaxBytes),
io_lib:format(" ~p: ~s~n", [Tag, Str]).
%% From OTP stdlib's lib.erl ... These functions aren't exported.
View
6 src/trunc_io.erl → src/lager_trunc_io.erl
@@ -25,8 +25,12 @@
%%
%% Source license: Erlang Public License.
%% Original author: Matthias Lang, <tt>matthias@corelatus.se</tt>
+%%
+%% Various changes to this module, most notably the format/3 implementation
+%% were added by Andrew Thompson <andrew@basho.com>. The module has been renamed
+%% to avoid conflicts with the vanilla module.
--module(trunc_io).
+-module(lager_trunc_io).
-author('matthias@corelatus.se').
%% And thanks to Chris Newcombe for a bug fix
-export([format/3, print/2, fprint/2, safe/2]). % interface functions
View
2 test/trunc_io_eqc.erl
@@ -142,7 +142,7 @@ prop_format() ->
FudgeLen = 50, %% trunc_io does not correctly calc safe size of pid/port/numbers/funs
{FmtStr, Args} = build_fmt_args(FmtArgs),
try
- Str = lists:flatten(trunc_io:format(FmtStr, Args, MaxLen)),
+ Str = lists:flatten(lager_trunc_io:format(FmtStr, Args, MaxLen)),
?WHENFAIL(begin
io:format(user, "FmtStr: ~p\n", [FmtStr]),
io:format(user, "Args: ~p\n", [Args]),

0 comments on commit 4ac0137

Please sign in to comment.
Something went wrong with that request. Please try again.