aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2018-10-25 14:56:36 +0200
committerRaimo Niskanen <[email protected]>2018-11-16 14:40:44 +0100
commit6c17eb4036eaa9afba86929821b6ec81a91c2787 (patch)
treea977aa62fd1ce6f1091c64db630392ac7795df01 /lib
parent5d530cdfa1f6d7a75f8933b8ce95df8fdbb82b9e (diff)
downloadotp-6c17eb4036eaa9afba86929821b6ec81a91c2787.tar.gz
otp-6c17eb4036eaa9afba86929821b6ec81a91c2787.tar.bz2
otp-6c17eb4036eaa9afba86929821b6ec81a91c2787.zip
Limit more error_logger terms
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/src/gen_fsm.erl17
-rw-r--r--lib/stdlib/src/gen_server.erl12
-rw-r--r--lib/stdlib/src/gen_statem.erl25
3 files changed, 26 insertions, 28 deletions
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index 1b8401305a..6be12437bb 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -671,28 +671,29 @@ format_log(#{label:={gen_fsm,terminate},
Reason
end,
{ClientFmt,ClientArgs} = format_client_log(ClientInfo),
- LimitedLog = [error_logger:limit_term(D) || D <- Log],
{"** State machine ~tp terminating \n" ++
get_msg_str(Msg) ++
"** When State == ~tp~n"
"** Data == ~tp~n"
"** Reason for termination ==~n** ~tp~n" ++
- case LimitedLog of
+ case Log of
[] -> [];
_ -> "** Log ==~n** ~tp~n"
end ++ ClientFmt,
- [Name|get_msg(Msg)] ++
- [StateName, StateData, Reason1 |
- case LimitedLog of
+ [Name|error_logger:limit_term(get_msg(Msg))] ++
+ [StateName,
+ error_logger:limit_term(StateData),
+ error_logger:limit_term(Reason1) |
+ case Log of
[] -> [];
- _ -> [LimitedLog]
+ _ -> [[error_logger:limit_term(D) || D <- Log]]
end] ++ ClientArgs};
format_log(#{label:={gen_fsm,no_handle_info},
module:=Mod,
message:=Msg}) ->
{"** Undefined handle_info in ~p~n"
"** Unhandled message: ~tp~n",
- [Mod, Msg]}.
+ [Mod, error_logger:limit_term(Msg)]}.
get_msg_str({'$gen_event', _Event}) ->
"** Last event in was ~tp~n";
@@ -726,7 +727,7 @@ format_client_log({From,remote}) ->
format_client_log({_From,{Name,Stacktrace}}) ->
{"** Client ~tp stacktrace~n"
"** ~tp~n",
- [Name, Stacktrace]}.
+ [Name, error_logger:limit_term(Stacktrace)]}.
%%-----------------------------------------------------------------
%% Status information
diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl
index 7de62eaf01..3f7c392c12 100644
--- a/lib/stdlib/src/gen_server.erl
+++ b/lib/stdlib/src/gen_server.erl
@@ -936,11 +936,11 @@ format_log(#{label:={gen_server,terminate},
end
end;
_ ->
- error_logger:limit_term(Reason)
+ Reason
end,
{ClientFmt,ClientArgs} = format_client_log(Client),
- [LimitedState|LimitedLog] =
- [error_logger:limit_term(D) || D <- [State|Log]],
+ [LimitedMsg,LimitedState,LimitedReason|LimitedLog] =
+ [error_logger:limit_term(D) || D <- [Msg,State,Reason1|Log]],
{"** Generic server ~tp terminating \n"
"** Last message in was ~tp~n"
"** When Server state == ~tp~n"
@@ -949,7 +949,7 @@ format_log(#{label:={gen_server,terminate},
[] -> [];
_ -> "** Log ==~n** ~tp~n"
end ++ ClientFmt,
- [Name, Msg, LimitedState, Reason1] ++
+ [Name, LimitedMsg, LimitedState, LimitedReason] ++
case LimitedLog of
[] -> [];
_ -> [LimitedLog]
@@ -959,7 +959,7 @@ format_log(#{label:={gen_server,no_handle_info},
message:=Msg}) ->
{"** Undefined handle_info in ~p~n"
"** Unhandled message: ~tp~n",
- [Mod, Msg]}.
+ [Mod, error_logger:limit_term(Msg)]}.
format_client_log(undefined) ->
{"", []};
@@ -970,7 +970,7 @@ format_client_log({From,remote}) ->
format_client_log({_From,{Name,Stacktrace}}) ->
{"** Client ~tp stacktrace~n"
"** ~tp~n",
- [Name, Stacktrace]}.
+ [Name, error_logger:limit_term(Stacktrace)]}.
%%-----------------------------------------------------------------
%% Status information
diff --git a/lib/stdlib/src/gen_statem.erl b/lib/stdlib/src/gen_statem.erl
index aef242bd4b..e21a0ecc26 100644
--- a/lib/stdlib/src/gen_statem.erl
+++ b/lib/stdlib/src/gen_statem.erl
@@ -1996,15 +1996,12 @@ format_log(#{label:={gen_statem,terminate},
true ->
{Reason,Stacktrace};
false ->
- {{'function not exported',{M,F,Arity}},
- ST}
+ {{'function not exported',{M,F,Arity}},ST}
end
end;
_ -> {Reason,Stacktrace}
end,
{ClientFmt,ClientArgs} = format_client_log(ClientInfo),
- [LimitedP,LimitedFmtData,LimitedFixedReason|LimitedLog] =
- [error_logger:limit_term(D) || D <- [P,FmtData,FixedReason|Log]],
CBMode =
case StateEnter of
true ->
@@ -2032,33 +2029,33 @@ format_log(#{label:={gen_statem,terminate},
[] -> "";
_ -> "** Stacktrace =~n** ~tp~n"
end ++
- case LimitedLog of
+ case Log of
[] -> "";
_ -> "** Log =~n** ~tp~n"
end ++ ClientFmt,
[Name |
case Q of
[] -> [];
- [Event|_] -> [Event]
+ [Event|_] -> [error_logger:limit_term(Event)]
end] ++
- [LimitedFmtData,
- Class,LimitedFixedReason,
+ [error_logger:limit_term(FmtData),
+ Class,error_logger:limit_term(FixedReason),
CBMode] ++
case Q of
- [_|[_|_] = Events] -> [Events];
+ [_|[_|_] = Events] -> [error_logger:limit_term(Events)];
_ -> []
end ++
case P of
[] -> [];
- _ -> [LimitedP]
+ _ -> [error_logger:limit_term(P)]
end ++
case FixedStacktrace of
[] -> [];
- _ -> [FixedStacktrace]
+ _ -> [error_logger:limit_term(FixedStacktrace)]
end ++
- case LimitedLog of
+ case Log of
[] -> [];
- _ -> [LimitedLog]
+ _ -> [[error_logger:limit_term(T) || T <- Log]]
end ++ ClientArgs}.
format_client_log(undefined) ->
@@ -2070,7 +2067,7 @@ format_client_log({Pid,remote}) ->
format_client_log({_Pid,{Name,Stacktrace}}) ->
{"** Client ~tp stacktrace~n"
"** ~tp~n",
- [Name, Stacktrace]}.
+ [Name, error_logger:limit_term(Stacktrace)]}.
%% Call Module:format_status/2 or return a default value