|
@ -8,7 +8,7 @@ |
|
|
-import(gen_call, [gcall/3, gcall/4, greply/2]). |
|
|
-import(gen_call, [gcall/3, gcall/4, greply/2]). |
|
|
|
|
|
|
|
|
-export([ |
|
|
-export([ |
|
|
%% API for gen_apu |
|
|
|
|
|
|
|
|
%% API for gen_mpp |
|
|
start/3, start/4, start_link/3, start_link/4 |
|
|
start/3, start/4, start_link/3, start_link/4 |
|
|
, start_monitor/3, start_monitor/4 |
|
|
, start_monitor/3, start_monitor/4 |
|
|
, stop/1, stop/3 |
|
|
, stop/1, stop/3 |
|
@ -238,9 +238,9 @@ init_it(Starter, Parent, ServerRef, Module, Args, Options) -> |
|
|
%%----------------------------------------------------------------- |
|
|
%%----------------------------------------------------------------- |
|
|
%% enter_loop(Module, Options, State, <ServerName>, <TimeOut>) ->_ |
|
|
%% enter_loop(Module, Options, State, <ServerName>, <TimeOut>) ->_ |
|
|
%% |
|
|
%% |
|
|
%% Description: Makes an existing process into a gen_apu. |
|
|
|
|
|
%% The calling process will enter the gen_apu receive |
|
|
|
|
|
%% loop and become a gen_apu process. |
|
|
|
|
|
|
|
|
%% Description: Makes an existing process into a gen_mpp. |
|
|
|
|
|
%% The calling process will enter the gen_mpp receive |
|
|
|
|
|
%% loop and become a gen_mpp process. |
|
|
%% The process *must* have been started using one of the |
|
|
%% The process *must* have been started using one of the |
|
|
%% start functions in proc_lib, see proc_lib(3). |
|
|
%% start functions in proc_lib, see proc_lib(3). |
|
|
%% The user is responsible for any initialization of the |
|
|
%% The user is responsible for any initialization of the |
|
@ -936,8 +936,8 @@ try_terminate(Mod, Reason, State) -> |
|
|
catch |
|
|
catch |
|
|
throw:R -> |
|
|
throw:R -> |
|
|
{ok, R}; |
|
|
{ok, R}; |
|
|
Class:R -> |
|
|
|
|
|
{'EXIT', Class, R, ?STACKTRACE()} |
|
|
|
|
|
|
|
|
Class:R:S -> |
|
|
|
|
|
{'EXIT', Class, R, S} |
|
|
end; |
|
|
end; |
|
|
false -> |
|
|
false -> |
|
|
{ok, ok} |
|
|
{ok, ok} |
|
@ -953,7 +953,7 @@ error_info(_Reason, application_controller, _From, _Msg, _Mod, _State, _Debug) - |
|
|
ok; |
|
|
ok; |
|
|
error_info(Reason, Name, From, Msg, Module, Debug, State) -> |
|
|
error_info(Reason, Name, From, Msg, Module, Debug, State) -> |
|
|
Log = sys:get_log(Debug), |
|
|
Log = sys:get_log(Debug), |
|
|
?LOG_ERROR(#{label => {gen_apu, terminate}, |
|
|
|
|
|
|
|
|
?LOG_ERROR(#{label => {gen_mpp, terminate}, |
|
|
name => Name, |
|
|
name => Name, |
|
|
last_message => Msg, |
|
|
last_message => Msg, |
|
|
state => format_status(terminate, Module, get(), State), |
|
|
state => format_status(terminate, Module, get(), State), |
|
@ -962,8 +962,8 @@ error_info(Reason, Name, From, Msg, Module, Debug, State) -> |
|
|
client_info => client_stacktrace(From)}, |
|
|
client_info => client_stacktrace(From)}, |
|
|
#{ |
|
|
#{ |
|
|
domain => [otp], |
|
|
domain => [otp], |
|
|
report_cb => fun gen_apu:format_log/2, |
|
|
|
|
|
error_logger => #{tag => error, report_cb => fun gen_apu:format_log/1} |
|
|
|
|
|
|
|
|
report_cb => fun gen_mpp:format_log/2, |
|
|
|
|
|
error_logger => #{tag => error, report_cb => fun gen_mpp:format_log/1} |
|
|
}), |
|
|
}), |
|
|
ok. |
|
|
ok. |
|
|
|
|
|
|
|
@ -999,7 +999,7 @@ format_log(Report) -> |
|
|
|
|
|
|
|
|
limit_report(Report, unlimited) -> |
|
|
limit_report(Report, unlimited) -> |
|
|
Report; |
|
|
Report; |
|
|
limit_report(#{label := {gen_apu, terminate}, |
|
|
|
|
|
|
|
|
limit_report(#{label := {gen_mpp, terminate}, |
|
|
last_message := Msg, |
|
|
last_message := Msg, |
|
|
state := State, |
|
|
state := State, |
|
|
log := Log, |
|
|
log := Log, |
|
@ -1013,7 +1013,7 @@ limit_report(#{label := {gen_apu, terminate}, |
|
|
reason => io_lib:limit_term(Reason, Depth), |
|
|
reason => io_lib:limit_term(Reason, Depth), |
|
|
client_info => limit_client_report(Client, Depth) |
|
|
client_info => limit_client_report(Client, Depth) |
|
|
}; |
|
|
}; |
|
|
limit_report(#{label := {gen_apu, no_handle_info}, |
|
|
|
|
|
|
|
|
limit_report(#{label := {gen_mpp, no_handle_info}, |
|
|
message := Msg} = Report, Depth) -> |
|
|
message := Msg} = Report, Depth) -> |
|
|
Report#{message => io_lib:limit_term(Msg, Depth)}. |
|
|
Report#{message => io_lib:limit_term(Msg, Depth)}. |
|
|
|
|
|
|
|
@ -1040,7 +1040,7 @@ format_log(Report, FormatOpts0) -> |
|
|
{Format, Args} = format_log_single(Report, FormatOpts), |
|
|
{Format, Args} = format_log_single(Report, FormatOpts), |
|
|
io_lib:format(Format, Args, IoOpts). |
|
|
io_lib:format(Format, Args, IoOpts). |
|
|
|
|
|
|
|
|
format_log_single(#{label := {gen_apu, terminate}, |
|
|
|
|
|
|
|
|
format_log_single(#{label := {gen_mpp, terminate}, |
|
|
name := Name, |
|
|
name := Name, |
|
|
last_message := Msg, |
|
|
last_message := Msg, |
|
|
state := State, |
|
|
state := State, |
|
@ -1063,7 +1063,7 @@ format_log_single(#{label := {gen_apu, terminate}, |
|
|
end, |
|
|
end, |
|
|
{Format1 ++ ServerLogFormat ++ ClientLogFormat, |
|
|
{Format1 ++ ServerLogFormat ++ ClientLogFormat, |
|
|
Args1 ++ ServerLogArgs ++ ClientLogArgs}; |
|
|
Args1 ++ ServerLogArgs ++ ClientLogArgs}; |
|
|
format_log_single(#{label := {gen_apu, no_handle_info}, |
|
|
|
|
|
|
|
|
format_log_single(#{label := {gen_mpp, no_handle_info}, |
|
|
module := Module, |
|
|
module := Module, |
|
|
message := Msg}, |
|
|
message := Msg}, |
|
|
#{single_line := true, depth := Depth} = FormatOpts) -> |
|
|
#{single_line := true, depth := Depth} = FormatOpts) -> |
|
@ -1081,7 +1081,7 @@ format_log_single(#{label := {gen_apu, no_handle_info}, |
|
|
format_log_single(Report, FormatOpts) -> |
|
|
format_log_single(Report, FormatOpts) -> |
|
|
format_log_multi(Report, FormatOpts). |
|
|
format_log_multi(Report, FormatOpts). |
|
|
|
|
|
|
|
|
format_log_multi(#{label := {gen_apu, terminate}, |
|
|
|
|
|
|
|
|
format_log_multi(#{label := {gen_mpp, terminate}, |
|
|
name := Name, |
|
|
name := Name, |
|
|
last_message := Msg, |
|
|
last_message := Msg, |
|
|
state := State, |
|
|
state := State, |
|
@ -1116,7 +1116,7 @@ format_log_multi(#{label := {gen_apu, terminate}, |
|
|
end ++ ClientArgs |
|
|
end ++ ClientArgs |
|
|
end, |
|
|
end, |
|
|
{Format, Args}; |
|
|
{Format, Args}; |
|
|
format_log_multi(#{label := {gen_apu, no_handle_info}, |
|
|
|
|
|
|
|
|
format_log_multi(#{label := {gen_mpp, no_handle_info}, |
|
|
module := Module, |
|
|
module := Module, |
|
|
message := Msg}, |
|
|
message := Msg}, |
|
|
#{depth := Depth} = FormatOpts) -> |
|
|
#{depth := Depth} = FormatOpts) -> |
|
|