From 584f9ec69fea19e1fed4a37699cb83e0d3c9bf94 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Fri, 10 Jan 2014 16:03:54 +0100 Subject: Implement new telnet logging system --- .../test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl | 10 +++++++++- .../ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl | 10 +++++++++- lib/common_test/test/telnet_server.erl | 15 ++++++++------- 3 files changed, 26 insertions(+), 9 deletions(-) (limited to 'lib/common_test/test') diff --git a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl index 914b95f9cf..da0c594eda 100644 --- a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl +++ b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl @@ -16,7 +16,15 @@ end_per_suite(_Config) -> ok. -suite() -> [{require,telnet_temp,{unix,[telnet]}}]. +suite() -> [ + {require,telnet_temp,{unix,[telnet]}} + +%% , +%% {ct_hooks, [{cth_conn_log, +%% [{ct_telnet,[{log_type,raw}, +%% {hosts,[telnet_temp]}] +%% }] }] } + ]. all() -> [start_stop, send_and_get, expect, already_closed, diff --git a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl index 3f7c0d68bf..ec2dd5db8b 100644 --- a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl +++ b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl @@ -15,7 +15,15 @@ end_per_suite(_Config) -> ok. -suite() -> [{require,erl_telnet_server,{unix,[telnet]}}]. +suite() -> + [ + {require,erl_telnet_server,{unix,[telnet]}}, + + {ct_hooks, [{cth_conn_log, + [{ct_telnet,[{log_type,raw}, + {hosts,[erl_telnet_server]}] + }] }] } + ]. all() -> [expect, diff --git a/lib/common_test/test/telnet_server.erl b/lib/common_test/test/telnet_server.erl index 31884aa182..1760100d8e 100644 --- a/lib/common_test/test/telnet_server.erl +++ b/lib/common_test/test/telnet_server.erl @@ -64,18 +64,19 @@ accept(#state{listen=LSock}=State) -> {Acceptor,Sock} when is_port(Sock) -> case init_client(State#state{client=Sock}) of stopped -> - io:format("telnet_server stopped\n"), + io:format("[telnet_server] telnet_server stopped\n"), ok; R -> - io:format("connection to client closed with reason ~p~n",[R]), + io:format("[telnet_server] connection to client" + "closed with reason ~p~n",[R]), accept(State) end; {Acceptor,closed} -> - io:format("listen socket closed unexpectedly, " + io:format("[telnet_server] listen socket closed unexpectedly, " "terminating telnet_server\n"), ok; stop -> - io:format("telnet_server stopped\n"), + io:format("[telnet_server] telnet_server stopped\n"), ok end. @@ -188,7 +189,7 @@ do_handle_data(_Data,State) -> check_user(User,State) -> case lists:keyfind(User,1,State#state.users) of {User,Pwd} -> - dbg("user ok\n"), + dbg("user ok\n"), send("Password: ",State), {ok,State#state{authorized={user,Pwd}}}; false -> @@ -223,6 +224,6 @@ get_line([],_) -> false. dbg(_F) -> - io:format(_F). + dbg(_F,[]). dbg(_F,_A) -> - io:format(_F,_A). + io:format("[telnet_server] "++_F,_A). -- cgit v1.2.3