From 4e3ea7ba98da34c827203a8d439b6d834e98e1a0 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Fri, 1 Mar 2013 17:28:27 -0800 Subject: [PATCH] Improve lager_console_backend to support non-atom output log levels. This supports forms such as "!notice" for configuring the output log level (using the config handling changes from 7aa316902e2d). --- src/lager_console_backend.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lager_console_backend.erl b/src/lager_console_backend.erl index 4690a40..442204a 100644 --- a/src/lager_console_backend.erl +++ b/src/lager_console_backend.erl @@ -36,13 +36,11 @@ -define(TERSE_FORMAT,[time, " [", severity,"] ", message, "\r\n"]). %% @private -init(Level) when is_atom(Level) -> - init([Level,{lager_default_formatter,?TERSE_FORMAT}]); init([Level, true]) -> % for backwards compatibility init([Level,{lager_default_formatter,[{eol, "\r\n"}]}]); init([Level,false]) -> % for backwards compatibility init([Level,{lager_default_formatter,?TERSE_FORMAT}]); -init([Level,{Formatter,FormatterConfig}]) when is_atom(Level), is_atom(Formatter)-> +init([Level,{Formatter,FormatterConfig}]) when is_atom(Formatter) -> try lager_util:config_to_mask(Level) of Levels -> {ok, #state{level=Levels, @@ -51,7 +49,9 @@ init([Level,{Formatter,FormatterConfig}]) when is_atom(Level), is_atom(Formatte catch _:_ -> {error, bad_log_level} - end. + end; +init(Level) -> + init([Level,{lager_default_formatter,?TERSE_FORMAT}]). %% @private