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