aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/cth_log_redirect.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2013-09-01 23:36:24 +0200
committerPeter Andersson <[email protected]>2013-09-03 17:02:14 +0200
commit376da624578485aae6160d8ee327330d58613fae (patch)
treef97b792846560be7998fea40bdd9aa10e2dd56bd /lib/common_test/src/cth_log_redirect.erl
parent112b1f795ccd573a612208269e9b4937865445b5 (diff)
downloadotp-376da624578485aae6160d8ee327330d58613fae.tar.gz
otp-376da624578485aae6160d8ee327330d58613fae.tar.bz2
otp-376da624578485aae6160d8ee327330d58613fae.zip
Find and fix minor bugs
Diffstat (limited to 'lib/common_test/src/cth_log_redirect.erl')
-rw-r--r--lib/common_test/src/cth_log_redirect.erl23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/common_test/src/cth_log_redirect.erl b/lib/common_test/src/cth_log_redirect.erl
index a030701f19..11af1aa346 100644
--- a/lib/common_test/src/cth_log_redirect.erl
+++ b/lib/common_test/src/cth_log_redirect.erl
@@ -36,13 +36,17 @@
handle_event/2, handle_call/2, handle_info/2,
terminate/1]).
+%% Other
+-export([handle_remote_events/1]).
+
-include("ct.hrl").
-record(eh_state, {log_func,
curr_suite,
curr_group,
curr_func,
- parallel_tcs = false}).
+ parallel_tcs = false,
+ handle_remote_events = false}).
id(_Opts) ->
?MODULE.
@@ -51,7 +55,6 @@ init(?MODULE, _Opts) ->
error_logger:add_report_handler(?MODULE),
tc_log_async.
-
pre_init_per_suite(Suite, Config, State) ->
set_curr_func({Suite,init_per_suite}, Config),
{Config, State}.
@@ -104,7 +107,8 @@ post_end_per_group(_Group, Config, Return, State) ->
init(_Type) ->
{ok, #eh_state{log_func = tc_log_async}}.
-handle_event({_Type, GL, _Msg}, State) when node(GL) /= node() ->
+handle_event({_Type,GL,_Msg}, #eh_state{handle_remote_events = false} = State)
+ when node(GL) /= node() ->
{ok, State};
handle_event(Event, #eh_state{log_func = LogFunc} = State) ->
case lists:keyfind(sasl, 1, application:which_applications()) of
@@ -160,9 +164,12 @@ handle_call({set_curr_func,undefined,_Config}, State) ->
handle_call({set_curr_func,TC,_Config}, State) ->
{ok, ok, State#eh_state{curr_func = TC}};
-handle_call({set_logfunc,NewLogFunc},State) ->
+handle_call({set_logfunc,NewLogFunc}, State) ->
{ok, NewLogFunc, State#eh_state{log_func = NewLogFunc}};
+handle_call({handle_remote_events,Bool}, State) ->
+ {ok, ok, State#eh_state{handle_remote_events = Bool}};
+
handle_call(_Query, _State) ->
{error, bad_query}.
@@ -179,8 +186,16 @@ set_curr_func(CurrFunc, Config) ->
set_log_func(Func) ->
gen_event:call(error_logger, ?MODULE, {set_logfunc, Func}).
+handle_remote_events(Bool) ->
+ gen_event:call(error_logger, ?MODULE, {handle_remote_events, Bool}).
+
%%%-----------------------------------------------------------------
+format_header(#eh_state{curr_suite = undefined,
+ curr_group = undefined,
+ curr_func = undefined}) ->
+ io_lib:format("System report", []);
+
format_header(#eh_state{curr_suite = Suite,
curr_group = undefined,
curr_func = undefined}) ->