aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2015-10-08 14:14:11 +0200
committerSiri Hansen <[email protected]>2015-10-08 14:14:11 +0200
commitc5810d92afe70ab460f23234665b31cba743bc0a (patch)
treef091f5fad8a7ba260e6ac44766cb2f8baa04308a /lib/common_test
parent4c8723f377b6db8e9899c4192887284feb3c3cf4 (diff)
downloadotp-c5810d92afe70ab460f23234665b31cba743bc0a.tar.gz
otp-c5810d92afe70ab460f23234665b31cba743bc0a.tar.bz2
otp-c5810d92afe70ab460f23234665b31cba743bc0a.zip
Don't attempt logging when log type is 'silent'
The error logger handler ct_conn_log_h in common_test did not respect the 'silent' option, and tried to print to an undefined file descriptor. This has been corrected.
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/src/ct_conn_log_h.erl22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/common_test/src/ct_conn_log_h.erl b/lib/common_test/src/ct_conn_log_h.erl
index 2dd4fdac05..5239ec1ff8 100644
--- a/lib/common_test/src/ct_conn_log_h.erl
+++ b/lib/common_test/src/ct_conn_log_h.erl
@@ -104,18 +104,26 @@ terminate(_,#state{logs=Logs}) ->
%%%-----------------------------------------------------------------
%%% Writing reports
write_report(_Time,#conn_log{header=false,module=ConnMod}=Info,Data,GL,State) ->
- {LogType,Fd} = get_log(Info,GL,State),
- io:format(Fd,"~n~ts",[format_data(ConnMod,LogType,Data)]);
+ case get_log(Info,GL,State) of
+ {silent,_} ->
+ ok;
+ {LogType,Fd} ->
+ io:format(Fd,"~n~ts",[format_data(ConnMod,LogType,Data)])
+ end;
write_report(Time,#conn_log{module=ConnMod}=Info,Data,GL,State) ->
- {LogType,Fd} = get_log(Info,GL,State),
- io:format(Fd,"~n~ts~ts~ts",[format_head(ConnMod,LogType,Time),
- format_title(LogType,Info),
- format_data(ConnMod,LogType,Data)]).
+ case get_log(Info,GL,State) of
+ {silent,_} ->
+ ok;
+ {LogType,Fd} ->
+ io:format(Fd,"~n~ts~ts~ts",[format_head(ConnMod,LogType,Time),
+ format_title(LogType,Info),
+ format_data(ConnMod,LogType,Data)])
+ end.
write_error(Time,#conn_log{module=ConnMod}=Info,Report,GL,State) ->
case get_log(Info,GL,State) of
- {html,_} ->
+ {LogType,_} when LogType==html; LogType==silent ->
%% The error will anyway be written in the html log by the
%% sasl error handler, so don't write it again.
ok;