aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-05-12 19:03:40 +0200
committerLoïc Hoguin <[email protected]>2019-05-12 19:03:40 +0200
commit76eb7fa5f5c62e5c756838bf5c2c7a0df7c6d7bd (patch)
tree0ee061c3838e16c189081e986096491218d2d91e
parent4abd27adb55f8c2d2f29629c5d4645b126481252 (diff)
downloadranch-76eb7fa5f5c62e5c756838bf5c2c7a0df7c6d7bd.tar.gz
ranch-76eb7fa5f5c62e5c756838bf5c2c7a0df7c6d7bd.tar.bz2
ranch-76eb7fa5f5c62e5c756838bf5c2c7a0df7c6d7bd.zip
Properly document logger option; change default to logger
We now require OTP-21+ therefore there's no need to keep the default of error_logger.
-rw-r--r--doc/src/manual/ranch.asciidoc8
-rw-r--r--src/ranch.erl7
-rw-r--r--src/ranch_acceptors_sup.erl2
-rw-r--r--src/ranch_conns_sup.erl2
4 files changed, 12 insertions, 7 deletions
diff --git a/doc/src/manual/ranch.asciidoc b/doc/src/manual/ranch.asciidoc
index 3f14cf0..aa4a63f 100644
--- a/doc/src/manual/ranch.asciidoc
+++ b/doc/src/manual/ranch.asciidoc
@@ -96,6 +96,10 @@ handshake_timeout (5000)::
Maximum allowed time for the `ranch:handshake/1,2` call to finish.
+logger (logger)::
+
+The module that will be used to write log messages.
+
max_connections (1024)::
Maximum number of active connections per connection supervisor.
@@ -135,8 +139,10 @@ Unique name used to refer to a listener.
* *2.0*: The option `max_connections` is now per connection supervisor.
* *2.0*: The `num_conns_sup` option was added.
* *2.0*: The `socket` option was removed.
+* *2.0*: The `logger` option is no longer experimental. It now defaults
+ to `logger` instead of `error_logger`.
* *2.0*: The `opt()` type was removed.
-* *1.6*: The `logger` option was added.
+* *1.6*: The experimental `logger` option was added.
* *1.6*: The `opt()` type was deprecated in favor of the new `opts()` type.
== See also
diff --git a/src/ranch.erl b/src/ranch.erl
index fc6a3c8..a0fdea6 100644
--- a/src/ranch.erl
+++ b/src/ranch.erl
@@ -379,7 +379,7 @@ filter_user_options([], _) ->
filter_options_warning(Opt) ->
Logger = case get(logger) of
- undefined -> error_logger;
+ undefined -> logger;
Logger0 -> Logger0
end,
log(warning,
@@ -416,9 +416,8 @@ log(Level, Format, Args, #{logger := Logger})
when Logger =/= error_logger ->
_ = Logger:Level(Format, Args),
ok;
-%% We use error_logger by default. Because error_logger does
-%% not have all the levels we accept we have to do some
-%% mapping to error_logger functions.
+%% Because error_logger does not have all the levels
+%% we accept we have to do some mapping to error_logger functions.
log(Level, Format, Args, _) ->
Function = case Level of
emergency -> error_msg;
diff --git a/src/ranch_acceptors_sup.erl b/src/ranch_acceptors_sup.erl
index 8da93e3..965862a 100644
--- a/src/ranch_acceptors_sup.erl
+++ b/src/ranch_acceptors_sup.erl
@@ -25,7 +25,7 @@ start_link(Ref, NumAcceptors, Transport) ->
init([Ref, NumAcceptors, Transport]) ->
TransOpts = ranch_server:get_transport_options(Ref),
- Logger = maps:get(logger, TransOpts, error_logger),
+ Logger = maps:get(logger, TransOpts, logger),
NumListenSockets = maps:get(num_listen_sockets, TransOpts, 1),
SocketOpts = maps:get(socket_opts, TransOpts, []),
%% We temporarily put the logger in the process dictionary
diff --git a/src/ranch_conns_sup.erl b/src/ranch_conns_sup.erl
index 70947e1..a5c2206 100644
--- a/src/ranch_conns_sup.erl
+++ b/src/ranch_conns_sup.erl
@@ -108,7 +108,7 @@ init(Parent, Ref, Id, Transport, Protocol) ->
ConnType = maps:get(connection_type, TransOpts, worker),
Shutdown = maps:get(shutdown, TransOpts, 5000),
HandshakeTimeout = maps:get(handshake_timeout, TransOpts, 5000),
- Logger = maps:get(logger, TransOpts, error_logger),
+ Logger = maps:get(logger, TransOpts, logger),
ProtoOpts = ranch_server:get_protocol_options(Ref),
ok = proc_lib:init_ack(Parent, {ok, self()}),
loop(#state{parent=Parent, ref=Ref, conn_type=ConnType,