chore(config): default log.single_line=true

This commit is contained in:
Zaiming Shi 2021-05-06 09:47:34 +02:00 committed by Zaiming (Stone) Shi
parent 4cff5c4dac
commit 94c8add314
2 changed files with 5 additions and 15 deletions

View File

@ -449,10 +449,8 @@ log.file = emqx.log
#log.formatter = text #log.formatter = text
## Log to single line ## Log to single line
## Value: formatter_default | true | false ## Value: Boolean
## 'formatter_default' is equivalent to 'true' when log.formatter is 'json' #log.single_line = true
## 'formatter_default' is equivalent to 'false' when log.formatter is 'text'
#log.single_line = formatter_default
## Enables the log rotation. ## Enables the log rotation.
## With this enabled, new log files will be created when the current ## With this enabled, new log files will be created when the current

View File

@ -506,8 +506,8 @@ end}.
%% @doc format logs in a single line. %% @doc format logs in a single line.
{mapping, "log.single_line", "kernel.logger", [ {mapping, "log.single_line", "kernel.logger", [
{default, formatter_default}, {default, true},
{datatype, {enum, [formatter_default, true, false]}} {datatype, {enum, [true, false]}}
]}. ]}.
{mapping, "log.rotation", "kernel.logger", [ {mapping, "log.rotation", "kernel.logger", [
@ -606,16 +606,8 @@ end}.
-1 -> unlimited; -1 -> unlimited;
V -> V V -> V
end, end,
SingleLine0 = cuttlefish:conf_get("log.single_line", Conf), SingleLine = cuttlefish:conf_get("log.single_line", Conf),
FmtName = cuttlefish:conf_get("log.formatter", Conf), FmtName = cuttlefish:conf_get("log.formatter", Conf),
SingleLine = case SingleLine0 =:= formatter_default of
true when FmtName =:= text ->
false;
true when FmtName =:= json ->
true;
false ->
SingleLine0
end,
Formatter = Formatter =
case FmtName of case FmtName of
json -> json ->