From 4cf832f1ad163f5b25dd8a6f2d314c169c23c82f Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 28 Sep 2015 16:45:05 +0200 Subject: Don't log headings without content The netconf server collects data until an XML tag is completed before pretty printing received data. Each time data is logged, a heading like the following is printed: = CT_NETCONFC ==== 28-Sep-2015::16:43:46,842 =================================== = Client <0.194.0> <----- {"127.0.0.1",2060} =================================== This commit removes printing of this header if there is no data to be printed below - i.e. if the XML tag is not yet complete and we are waiting for more data. --- lib/common_test/src/ct_conn_log_h.erl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/common_test/src/ct_conn_log_h.erl') diff --git a/lib/common_test/src/ct_conn_log_h.erl b/lib/common_test/src/ct_conn_log_h.erl index 2dd4fdac05..5eb67853d9 100644 --- a/lib/common_test/src/ct_conn_log_h.erl +++ b/lib/common_test/src/ct_conn_log_h.erl @@ -109,9 +109,14 @@ write_report(_Time,#conn_log{header=false,module=ConnMod}=Info,Data,GL,State) -> 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 format_data(ConnMod,LogType,Data) of + [] -> + ok; + FormattedData -> + io:format(Fd,"~n~ts~ts~ts",[format_head(ConnMod,LogType,Time), + format_title(LogType,Info), + FormattedData]) + end. write_error(Time,#conn_log{module=ConnMod}=Info,Report,GL,State) -> case get_log(Info,GL,State) of -- cgit v1.2.3