aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-07-05 09:01:49 +0200
committerLoïc Hoguin <[email protected]>2018-07-05 09:01:49 +0200
commit8759b87a29c1318075e277eb35930396e35b1a6d (patch)
tree0a761b9df537090a9b4bb184f7287833bdb103a9 /test
parent3805bde6957663a9fabb4cc9912e8d090514fc30 (diff)
downloadranch-8759b87a29c1318075e277eb35930396e35b1a6d.tar.gz
ranch-8759b87a29c1318075e277eb35930396e35b1a6d.tar.bz2
ranch-8759b87a29c1318075e277eb35930396e35b1a6d.zip
Add a logger transport option
I had to use the process dictionary to work around the current interface for one log call. You have been warned.
Diffstat (limited to 'test')
-rw-r--r--test/acceptor_SUITE.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl
index c841a0a..c6b715e 100644
--- a/test/acceptor_SUITE.erl
+++ b/test/acceptor_SUITE.erl
@@ -65,6 +65,7 @@ groups() ->
misc_bad_transport_options,
misc_info,
misc_info_embedded,
+ misc_opts_logger,
misc_wait_for_connections
]}, {supervisor, [
connection_type_supervisor,
@@ -275,6 +276,22 @@ misc_info_embedded(_) ->
do_get_listener_info(ListenerGroup) ->
lists:sort([L || L={{G, _}, _} <- ranch:info(), G=:=ListenerGroup]).
+misc_opts_logger(_) ->
+ doc("Confirm that messages are sent via the configured logger module."),
+ register(name(), self()),
+ {ok, _} = ranch:start_listener(name(),
+ ranch_tcp, #{logger => ?MODULE, socket_opts => [<<"garbage">>]},
+ echo_protocol, []),
+ receive
+ {warning, "Transport option " ++ _, [<<"garbage">>]} ->
+ ok
+ after 1000 ->
+ error(timeout)
+ end.
+
+warning(Format, Args) ->
+ misc_opts_logger ! {warning, Format, Args}.
+
misc_wait_for_connections(_) ->
doc("Ensure wait for connections works."),
Name = name(),