From 8759b87a29c1318075e277eb35930396e35b1a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 5 Jul 2018 09:01:49 +0200 Subject: 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. --- test/acceptor_SUITE.erl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') 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(), -- cgit v1.2.3