Merge pull request #5453 from zmstone/fix-invalide-config-value-in-schema
fix(config): infinity is not valid for log.max_depth
This commit is contained in:
commit
258191a5b4
|
@ -426,16 +426,16 @@ log {
|
||||||
## Limits the total number of characters printed for each log event.
|
## Limits the total number of characters printed for each log event.
|
||||||
##
|
##
|
||||||
## @doc log.chars_limit
|
## @doc log.chars_limit
|
||||||
## ValueType: Integer | infinity
|
## ValueType: unlimited | Integer
|
||||||
## Range: [0, infinity)
|
## Range: [0, +Inf)
|
||||||
## Default: infinity
|
## Default: unlimited
|
||||||
chars_limit: infinity
|
chars_limit: unlimited
|
||||||
|
|
||||||
## Maximum depth for Erlang term log formatting
|
## Maximum depth for Erlang term log formatting
|
||||||
## and Erlang process message queue inspection.
|
## and Erlang process message queue inspection.
|
||||||
##
|
##
|
||||||
## @doc log.max_depth
|
## @doc log.max_depth
|
||||||
## ValueType: Integer | infinity
|
## ValueType: unlimited | Integer
|
||||||
## Default: 80
|
## Default: 80
|
||||||
max_depth: 80
|
max_depth: 80
|
||||||
|
|
||||||
|
|
|
@ -161,9 +161,11 @@ fields("log") ->
|
||||||
, {"console_handler", ref("console_handler")}
|
, {"console_handler", ref("console_handler")}
|
||||||
, {"file_handlers", ref("file_handlers")}
|
, {"file_handlers", ref("file_handlers")}
|
||||||
, {"time_offset", t(string(), undefined, "system")}
|
, {"time_offset", t(string(), undefined, "system")}
|
||||||
, {"chars_limit", maybe_infinity(range(1, inf))}
|
, {"chars_limit", #{type => hoconsc:union([unlimited, range(1, inf)]),
|
||||||
|
default => unlimited
|
||||||
|
}}
|
||||||
, {"supervisor_reports", t(union([error, progress]), undefined, error)}
|
, {"supervisor_reports", t(union([error, progress]), undefined, error)}
|
||||||
, {"max_depth", t(union([infinity, integer()]),
|
, {"max_depth", t(union([unlimited, integer()]),
|
||||||
"kernel.error_logger_format_depth", 80)}
|
"kernel.error_logger_format_depth", 80)}
|
||||||
, {"formatter", t(union([text, json]), undefined, text)}
|
, {"formatter", t(union([text, json]), undefined, text)}
|
||||||
, {"single_line", t(boolean(), undefined, true)}
|
, {"single_line", t(boolean(), undefined, true)}
|
||||||
|
@ -188,7 +190,8 @@ fields("log_file_handler") ->
|
||||||
[ {"level", t(log_level(), undefined, warning)}
|
[ {"level", t(log_level(), undefined, warning)}
|
||||||
, {"file", t(file(), undefined, undefined)}
|
, {"file", t(file(), undefined, undefined)}
|
||||||
, {"rotation", ref("log_rotation")}
|
, {"rotation", ref("log_rotation")}
|
||||||
, {"max_size", maybe_infinity(emqx_schema:bytesize(), "10MB")}
|
, {"max_size", #{type => union([infinity, emqx_schema:bytesize()]),
|
||||||
|
default => "10MB"}}
|
||||||
];
|
];
|
||||||
|
|
||||||
fields("log_rotation") ->
|
fields("log_rotation") ->
|
||||||
|
@ -258,8 +261,8 @@ tr_logger_level(Conf) -> conf_get("log.primary_level", Conf).
|
||||||
|
|
||||||
tr_logger(Conf) ->
|
tr_logger(Conf) ->
|
||||||
CharsLimit = case conf_get("log.chars_limit", Conf) of
|
CharsLimit = case conf_get("log.chars_limit", Conf) of
|
||||||
infinity -> unlimited;
|
unlimited -> unlimited;
|
||||||
V -> V
|
V when V > 0 -> V
|
||||||
end,
|
end,
|
||||||
SingleLine = conf_get("log.single_line", Conf),
|
SingleLine = conf_get("log.single_line", Conf),
|
||||||
FmtName = conf_get("log.formatter", Conf),
|
FmtName = conf_get("log.formatter", Conf),
|
||||||
|
@ -378,15 +381,6 @@ t(Type, Mapping, Default, OverrideEnv) ->
|
||||||
|
|
||||||
ref(Field) -> hoconsc:t(hoconsc:ref(Field)).
|
ref(Field) -> hoconsc:t(hoconsc:ref(Field)).
|
||||||
|
|
||||||
maybe_infinity(T) ->
|
|
||||||
maybe_sth(infinity, T, infinity).
|
|
||||||
|
|
||||||
maybe_infinity(T, Default) ->
|
|
||||||
maybe_sth(infinity, T, Default).
|
|
||||||
|
|
||||||
maybe_sth(What, Type, Default) ->
|
|
||||||
t(union([What, Type]), undefined, Default).
|
|
||||||
|
|
||||||
options(static, Conf) ->
|
options(static, Conf) ->
|
||||||
[{seeds, [to_atom(S) || S <- conf_get("cluster.static.seeds", Conf, [])]}];
|
[{seeds, [to_atom(S) || S <- conf_get("cluster.static.seeds", Conf, [])]}];
|
||||||
options(mcast, Conf) ->
|
options(mcast, Conf) ->
|
||||||
|
|
Loading…
Reference in New Issue