Remove extra get_formatter_opts/1 (#125)

* Remove extra get_formatter_opts/1

* Change defaults to max length and max printable string length

* Typo
This commit is contained in:
Sergey Yelin 2020-01-14 09:40:50 +03:00 committed by GitHub
parent 205982e6c0
commit ce178d0232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -11,6 +11,7 @@
-define(MAX_FLOAT_DECIMALS, 8).
%% Binaries under size below will log as-is.
-define(MAX_BIN_SIZE, 40).
-define(MAX_LENGTH, 1000).
-type limit() :: non_neg_integer() | unlimited.
@ -374,7 +375,7 @@ to_string(_) ->
normalize_options(Opts) ->
maps:merge(#{
max_depth => unlimited,
max_length => unlimited,
max_length => ?MAX_LENGTH,
max_printable_string_length => ?MAX_BIN_SIZE
}, Opts).

View File

@ -227,8 +227,7 @@ format_event_and_meta(Event, Meta, RpcID, EssentialMetaKeys) ->
-spec format_event_and_meta(event(), event_meta(), woody:rpc_id() | undefined, list(meta_key()), options()) ->
{severity(), msg(), meta()}.
format_event_and_meta(Event, Meta, RpcID, EssentialMetaKeys, Opts) ->
FormatOpts = get_formatter_opts(Opts),
{Severity, Msg} = format_event(Event, Meta, RpcID, FormatOpts),
{Severity, Msg} = format_event(Event, Meta, RpcID, Opts),
{Severity, Msg, get_essential_meta(Meta, Event, EssentialMetaKeys)}.
get_essential_meta(Meta, Event, Keys) ->