Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update the console backend to use new default formatter for verbose mode

  • Loading branch information...
commit 82eda718f244e2e67484ba75e853a06d4949f767 1 parent 7b05164
@Vagabond Vagabond authored
View
5 src/lager_console_backend.erl
@@ -33,18 +33,15 @@
-include("lager.hrl").
--define(VERBOSE_FORMAT,[date, " ", time, " [", severity, "] ", pid, "@", module,":", function, ":",line," ", message, "\r\n"]).
-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,?VERBOSE_FORMAT}]);
+ init([Level,{lager_default_formatter,[{eol, "\r\n"}]}]);
init([Level,false]) -> % for backwards compatibility
init([Level,{lager_default_formatter,?TERSE_FORMAT}]);
-init([Level,{Formatter,[]}]) ->
- init([Level,{Formatter,[]}]);
init([Level,{Formatter,FormatterConfig}]) when is_atom(Level), is_atom(Formatter)->
case lists:member(Level, ?LEVELS) of
true ->
View
4 src/lager_default_formatter.erl
@@ -37,6 +37,8 @@
%% @end
-spec format(#lager_log_message{},list()) -> any().
format(#lager_log_message{}=Msg,[]) ->
+ format(Msg, [{eol, "\n"}]);
+format(#lager_log_message{}=Msg,[{eol, EOL}]) ->
format(Msg,
[date, " ", time, " [", severity, "] ",
{pid, ""},
@@ -45,7 +47,7 @@ format(#lager_log_message{}=Msg,[]) ->
module,
{function, [":", function], ""},
{line, [":",line], ""}], ""},
- " ", message, "\n"]);
+ " ", message, EOL]);
format(Message,Config) ->
[ output(V,Message) || V <- Config ].
Please sign in to comment.
Something went wrong with that request. Please try again.