aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2014-01-10 16:03:54 +0100
committerPeter Andersson <[email protected]>2014-01-27 19:38:10 +0100
commit584f9ec69fea19e1fed4a37699cb83e0d3c9bf94 (patch)
treef96bef67262602c13d7102c8d887b86417376a7c /lib/common_test/test
parentbece9227ecffb5f164a383a826f63835bd32175a (diff)
downloadotp-584f9ec69fea19e1fed4a37699cb83e0d3c9bf94.tar.gz
otp-584f9ec69fea19e1fed4a37699cb83e0d3c9bf94.tar.bz2
otp-584f9ec69fea19e1fed4a37699cb83e0d3c9bf94.zip
Implement new telnet logging system
Diffstat (limited to 'lib/common_test/test')
-rw-r--r--lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl10
-rw-r--r--lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl10
-rw-r--r--lib/common_test/test/telnet_server.erl15
3 files changed, 26 insertions, 9 deletions
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).