diff options
author | José Valim <[email protected]> | 2014-05-09 18:07:07 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-05-11 11:50:10 +0200 |
commit | 42d25222fa7395ad9fb58de2c964afa4caefb5b1 (patch) | |
tree | 70f2f901969b5af63468e4bfd9e0e70e505e137b /lib/kernel | |
parent | 2dc1ca3bc664177a7d985c3e190464285e9b75fa (diff) | |
download | otp-42d25222fa7395ad9fb58de2c964afa4caefb5b1.tar.gz otp-42d25222fa7395ad9fb58de2c964afa4caefb5b1.tar.bz2 otp-42d25222fa7395ad9fb58de2c964afa4caefb5b1.zip |
Send format and args on process exit to error_logger
Previously, the emulator would generate a whole string
with values and call the error_logger passing "~s~n".
This commit changes it to a format string containing ~p
with the respective values as arguments.
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/test/error_logger_SUITE.erl | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/kernel/test/error_logger_SUITE.erl b/lib/kernel/test/error_logger_SUITE.erl index 05bf5aae18..1c2e56f083 100644 --- a/lib/kernel/test/error_logger_SUITE.erl +++ b/lib/kernel/test/error_logger_SUITE.erl @@ -32,7 +32,7 @@ error_report/1, info_report/1, error/1, info/1, emulator/1, tty/1, logfile/1, add/1, delete/1]). --export([generate_error/0]). +-export([generate_error/2]). -export([init/1, handle_event/2, handle_call/2, handle_info/2, @@ -210,13 +210,16 @@ emulator(suite) -> []; emulator(doc) -> []; emulator(Config) when is_list(Config) -> ?line error_logger:add_report_handler(?MODULE, self()), - spawn(?MODULE, generate_error, []), - reported(emulator), + Msg = "Error in process ~p on node ~p with exit value:~n~p~n", + Error = {badmatch,4}, + Stack = [{module, function, 2, []}], + Pid = spawn(?MODULE, generate_error, [Error, Stack]), + reported(error, Msg, [Pid, node(), {Error, Stack}]), ?line my_yes = error_logger:delete_report_handler(?MODULE), ok. -generate_error() -> - erlang:error({badmatch,4}). +generate_error(Error, Stack) -> + erlang:raise(error, Error, Stack). %%----------------------------------------------------------------- %% We don't enables or disables tty error logging here. We do not @@ -283,15 +286,6 @@ reported(Tag, Type, Report) -> test_server:fail(no_report_received) end. -reported(emulator) -> - receive - {error, "~s~n", String} when is_list(String) -> - test_server:messages_get(), - ok - after 1000 -> - test_server:fail(no_report_received) - end. - %%----------------------------------------------------------------- %% The error_logger handler (gen_event behaviour). %% Sends a notification to the Tester process about the events |