fix: truncate large payload
This commit is contained in:
parent
d5fe891961
commit
5a4dd3a5e5
|
@ -620,13 +620,13 @@ format_payload(Payload, hex) when ?MAX_PAYLOAD_FORMAT_LIMIT(Payload) ->
|
||||||
["Payload(hex)=", binary:encode_hex(Payload)];
|
["Payload(hex)=", binary:encode_hex(Payload)];
|
||||||
format_payload(_, hidden) ->
|
format_payload(_, hidden) ->
|
||||||
"Payload=******";
|
"Payload=******";
|
||||||
format_payload(<<Part:?MAX_PAYLOAD_FORMAT_SIZE, _/binary>> = Payload, _) ->
|
format_payload(<<Part:100, _/binary>> = Payload, _) ->
|
||||||
[
|
[
|
||||||
"Payload=",
|
"Payload=",
|
||||||
Part,
|
Part,
|
||||||
"...The ",
|
"... The ",
|
||||||
integer_to_list(byte_size(Payload) - ?MAX_PAYLOAD_FORMAT_SIZE),
|
integer_to_list(byte_size(Payload) - 100),
|
||||||
"bytes of this log are truncated"
|
" bytes of this log are truncated"
|
||||||
].
|
].
|
||||||
|
|
||||||
i(true) -> 1;
|
i(true) -> 1;
|
||||||
|
|
|
@ -76,12 +76,12 @@ format_payload(_, hidden) ->
|
||||||
format_payload(Payload, text) when ?MAX_PAYLOAD_FORMAT_LIMIT(Payload) ->
|
format_payload(Payload, text) when ?MAX_PAYLOAD_FORMAT_LIMIT(Payload) ->
|
||||||
unicode:characters_to_list(Payload);
|
unicode:characters_to_list(Payload);
|
||||||
format_payload(Payload, hex) when ?MAX_PAYLOAD_FORMAT_LIMIT(Payload) -> binary:encode_hex(Payload);
|
format_payload(Payload, hex) when ?MAX_PAYLOAD_FORMAT_LIMIT(Payload) -> binary:encode_hex(Payload);
|
||||||
format_payload(<<Part:?MAX_PAYLOAD_FORMAT_SIZE, _/binary>> = Payload, _) ->
|
format_payload(<<Part:100, _/binary>> = Payload, _) ->
|
||||||
[
|
[
|
||||||
Part,
|
Part,
|
||||||
"...The ",
|
"... The ",
|
||||||
integer_to_list(byte_size(Payload) - ?MAX_PAYLOAD_FORMAT_SIZE),
|
integer_to_list(byte_size(Payload) - 100),
|
||||||
"bytes of this log are truncated"
|
" bytes of this log are truncated"
|
||||||
].
|
].
|
||||||
|
|
||||||
to_iolist(Atom) when is_atom(Atom) -> atom_to_list(Atom);
|
to_iolist(Atom) when is_atom(Atom) -> atom_to_list(Atom);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Prevent client disconnected when sending large payloads with debug/trace logging is enabled.
|
Loading…
Reference in New Issue