[thrift] fix-ups to Erlang thrift_logger
Summary:
* no ?INFO for every oop:call ... way too expensive
* unfactor symbol/1 ... it was that way for a reason apparently
* upped crash report depth to 3
Reviewed By: eletuchy
Test Plan: /much/ less CPU eaten by logging
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665343 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/src/oop.erl b/lib/erl/src/oop.erl
index 11be4d4..e4de147 100644
--- a/lib/erl/src/oop.erl
+++ b/lib/erl/src/oop.erl
@@ -86,7 +86,8 @@
call(Obj, Func, []).
call(Obj, Func, ArgsProper) ->
- ?INFO("oop:call called: Obj=~p Func=~p ArgsProper=~p", [inspect(Obj), Func, ArgsProper]),
+ %% this is WAY too expensive
+ %% ?INFO("oop:call called: Obj=~p Func=~p ArgsProper=~p", [inspect(Obj), Func, ArgsProper]),
case call1(Obj, Func, ArgsProper) of
{ok, Value} -> Value;
{error, Kind, S1} -> error(Kind, S1)
diff --git a/lib/erl/src/thrift_logger.erl b/lib/erl/src/thrift_logger.erl
index 31a71b9..0d0b876 100644
--- a/lib/erl/src/thrift_logger.erl
+++ b/lib/erl/src/thrift_logger.erl
@@ -131,7 +131,13 @@
%%
handle_event1({What, _Gleader, {Ref, Format, Data}}, State) when is_list(Format) ->
- Symbol = symbol(What),
+ Symbol =
+ case What of
+ error -> "!!";
+ warning_msg -> "**";
+ info_msg -> "..";
+ _Else -> "??"
+ end,
case {Format, Data} of
{?GS_TERM_FORMAT, [Ref, LastMessage, Obj, Reason]} ->
@@ -174,7 +180,13 @@
{ok, State};
handle_event1({What, _Gleader, {Pid, Type, Report}}, State) ->
- Symbol = symbol(What),
+ Symbol =
+ case What of
+ error_report -> "!!";
+ warning_report -> "**";
+ info_report -> "..";
+ _Else -> "??"
+ end,
case Type of
crash_report ->
@@ -271,11 +283,6 @@
config(Item) ->
thrift:config(Item).
-symbol(error_report) -> "!!";
-symbol(warning_report) -> "**";
-symbol(info_report) -> "..";
-symbol(_Else) -> "??".
-
print_crash_report(Report) ->
case Report of
[[_,_,{error_info, XX}|_] | _] ->
@@ -283,7 +290,7 @@
tTransportException ->
ok;
_ ->
- io:format("~~~~ crash report: ~P~n", [XX, 2])
+ io:format("~~~~ crash report: ~P~n", [XX, 3])
end;
_ ->
io:format("~~~~ crash report (?): ~p~n", [Report])