|
|
@ -1279,9 +1279,20 @@ limit_report(#{label := {gen_srv, terminate}, |
|
|
|
reason => io_lib:limit_term(Reason, Depth), |
|
|
|
client_info => limit_client_report(Client, Depth) |
|
|
|
}; |
|
|
|
limit_report(#{label := {gen_srv, no_handle_info}, |
|
|
|
message := Msg} = Report, Depth) -> |
|
|
|
Report#{message => io_lib:limit_term(Msg, Depth)}. |
|
|
|
limit_report(#{label := {gen_srv, inner_error}, |
|
|
|
last_message := Msg, |
|
|
|
state := State, |
|
|
|
log := Log, |
|
|
|
reason := Reason, |
|
|
|
client_info := Client} = Report, |
|
|
|
Depth) -> |
|
|
|
Report#{ |
|
|
|
last_message => io_lib:limit_term(Msg, Depth), |
|
|
|
state => io_lib:limit_term(State, Depth), |
|
|
|
log => [io_lib:limit_term(L, Depth) || L <- Log], |
|
|
|
reason => io_lib:limit_term(Reason, Depth), |
|
|
|
client_info => limit_client_report(Client, Depth) |
|
|
|
}. |
|
|
|
|
|
|
|
limit_client_report({From, {Name, Stacktrace}}, Depth) -> |
|
|
|
{From, {Name, io_lib:limit_term(Stacktrace, Depth)}}; |
|
|
@ -1315,7 +1326,7 @@ format_log_single(#{label := {gen_srv, terminate}, |
|
|
|
client_info := Client}, |
|
|
|
#{single_line := true, depth := Depth} = FormatOpts) -> |
|
|
|
P = p(FormatOpts), |
|
|
|
Format1 = lists:append(["Generic server ", P, " terminating. Reason: ", P, |
|
|
|
Format1 = lists:append(["gen_srv ", P, " terminating. Reason: ", P, |
|
|
|
". Last message: ", P, ". State: ", P, "."]), |
|
|
|
{ServerLogFormat, ServerLogArgs} = format_server_log_single(Log, FormatOpts), |
|
|
|
{ClientLogFormat, ClientLogArgs} = format_client_log_single(Client, FormatOpts), |
|
|
@ -1327,23 +1338,29 @@ format_log_single(#{label := {gen_srv, terminate}, |
|
|
|
_ -> |
|
|
|
[Name, Depth, fix_reason(Reason), Depth, Msg, Depth, State, Depth] |
|
|
|
end, |
|
|
|
{Format1 ++ ServerLogFormat ++ ClientLogFormat, |
|
|
|
Args1 ++ ServerLogArgs ++ ClientLogArgs}; |
|
|
|
format_log_single(#{label := {gen_srv, no_handle_info}, |
|
|
|
module := Module, |
|
|
|
message := Msg}, |
|
|
|
{Format1 ++ ServerLogFormat ++ ClientLogFormat, Args1 ++ ServerLogArgs ++ ClientLogArgs}; |
|
|
|
format_log_single(#{label := {gen_srv, inner_error}, |
|
|
|
name := Name, |
|
|
|
last_message := Msg, |
|
|
|
state := State, |
|
|
|
log := Log, |
|
|
|
reason := Reason, |
|
|
|
client_info := Client}, |
|
|
|
#{single_line := true, depth := Depth} = FormatOpts) -> |
|
|
|
P = p(FormatOpts), |
|
|
|
Format = lists:append(["Undefined handle_info in ", P, |
|
|
|
". Unhandled message: ", P, "."]), |
|
|
|
Args = |
|
|
|
Format1 = lists:append(["gen_srv ", P, " inner_error. Reason: ", P, |
|
|
|
". Last message: ", P, ". State: ", P, "."]), |
|
|
|
{ServerLogFormat, ServerLogArgs} = format_server_log_single(Log, FormatOpts), |
|
|
|
{ClientLogFormat, ClientLogArgs} = format_client_log_single(Client, FormatOpts), |
|
|
|
|
|
|
|
Args1 = |
|
|
|
case Depth of |
|
|
|
unlimited -> |
|
|
|
[Module, Msg]; |
|
|
|
[Name, fix_reason(Reason), Msg, State]; |
|
|
|
_ -> |
|
|
|
[Module, Depth, Msg, Depth] |
|
|
|
[Name, Depth, fix_reason(Reason), Depth, Msg, Depth, State, Depth] |
|
|
|
end, |
|
|
|
{Format, Args}; |
|
|
|
{Format1 ++ ServerLogFormat ++ ClientLogFormat, Args1 ++ ServerLogArgs ++ ClientLogArgs}; |
|
|
|
format_log_single(Report, FormatOpts) -> |
|
|
|
format_log_multi(Report, FormatOpts). |
|
|
|
|
|
|
@ -1360,7 +1377,7 @@ format_log_multi(#{label := {gen_srv, terminate}, |
|
|
|
P = p(FormatOpts), |
|
|
|
Format = |
|
|
|
lists:append( |
|
|
|
["** Generic server ", P, " terminating \n" |
|
|
|
["** gen_srv ", P, " terminating \n" |
|
|
|
"** Last message in was ", P, "~n" |
|
|
|
"** When Server state == ", P, "~n" |
|
|
|
"** Reason for termination ==~n** ", P, "~n"] ++ |
|
|
@ -1382,20 +1399,39 @@ format_log_multi(#{label := {gen_srv, terminate}, |
|
|
|
end ++ ClientArgs |
|
|
|
end, |
|
|
|
{Format, Args}; |
|
|
|
format_log_multi(#{label := {gen_srv, no_handle_info}, |
|
|
|
module := Module, |
|
|
|
message := Msg}, |
|
|
|
format_log_multi(#{label := {gen_srv, inner_error}, |
|
|
|
name := Name, |
|
|
|
last_message := Msg, |
|
|
|
state := State, |
|
|
|
log := Log, |
|
|
|
reason := Reason, |
|
|
|
client_info := Client}, |
|
|
|
#{depth := Depth} = FormatOpts) -> |
|
|
|
Reason1 = fix_reason(Reason), |
|
|
|
{ClientFmt, ClientArgs} = format_client_log(Client, FormatOpts), |
|
|
|
P = p(FormatOpts), |
|
|
|
Format = |
|
|
|
"** Undefined handle_info in ~p~n" |
|
|
|
"** Unhandled message: " ++ P ++ "~n", |
|
|
|
lists:append( |
|
|
|
["** gen_srv ", P, " inner_error \n" |
|
|
|
"** Last message in was ", P, "~n" |
|
|
|
"** When Server state == ", P, "~n" |
|
|
|
"** Reason for termination ==~n** ", P, "~n"] ++ |
|
|
|
case Log of |
|
|
|
[] -> []; |
|
|
|
_ -> ["** Log ==~n** [" | |
|
|
|
lists:join(",~n ", lists:duplicate(length(Log), P))] ++ |
|
|
|
["]~n"] |
|
|
|
end) ++ ClientFmt, |
|
|
|
Args = |
|
|
|
case Depth of |
|
|
|
unlimited -> |
|
|
|
[Module, Msg]; |
|
|
|
[Name, Msg, State, Reason1] ++ Log ++ ClientArgs; |
|
|
|
_ -> |
|
|
|
[Module, Msg, Depth] |
|
|
|
[Name, Depth, Msg, Depth, State, Depth, Reason1, Depth] ++ |
|
|
|
case Log of |
|
|
|
[] -> []; |
|
|
|
_ -> lists:flatmap(fun(L) -> [L, Depth] end, Log) |
|
|
|
end ++ ClientArgs |
|
|
|
end, |
|
|
|
{Format, Args}. |
|
|
|
|
|
|
|