From a76c32db5e32ab6a6b35ce6625cb3aedcac067b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 28 Jun 2018 17:10:18 +0200 Subject: Introduce undocumented option logger This commit reworks the logging that Cowboy does via error_logger to make the module that will do the actual logging configurable. The logger module interface must be the same as logger and lager: a separate function per log level with the same log levels they support. The default behavior remains to call error_logger, although some messages were downgraded to warnings instead of errors. Since error_logger only supports three different log levels, some messages may get downgraded/upgraded depending on what the original log level was to make them compatible with error_logger. The {log, Level, Format, Args} command was also added to stream handlers. Stream handlers should use this command to log messages because it allows writing a stream handler to intercept some of those messages and extract information or block them as necessary. The logger option only applies to Cowboy itself, not to the messages Ranch logs, so more work remains to be done in that area. --- doc/src/manual/cowboy_stream.asciidoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'doc/src/manual') diff --git a/doc/src/manual/cowboy_stream.asciidoc b/doc/src/manual/cowboy_stream.asciidoc index 0207ad8..763cbd5 100644 --- a/doc/src/manual/cowboy_stream.asciidoc +++ b/doc/src/manual/cowboy_stream.asciidoc @@ -81,9 +81,8 @@ Stream handlers can return a list of commands to be executed from the `init/3`, `data/4` and `info/3` callbacks. In addition, the `early_error/5` callback must return a response command. -// @todo We need a 'log' command that would call error_logger. -// It's better than doing in the handlers directly because -// then we can have other stream handlers manipulate those logs. +// @todo The logger option and the {log, Level, Format, Args} +// options need to be documented and tested. The following commands are defined: -- cgit v1.2.3