File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,8 @@ pub fn init_background_tracing(
141141 let formatted = format ! ( "{value:?}" ) ;
142142 const MAX_MESSAGE_CHARS : usize = 280 ;
143143 if formatted. len ( ) > MAX_MESSAGE_CHARS {
144- write ! ( writer, "{}={}" , field_name, & formatted[ ..MAX_MESSAGE_CHARS ] ) ?;
144+ let boundary = formatted. floor_char_boundary ( MAX_MESSAGE_CHARS ) ;
145+ write ! ( writer, "{}={}" , field_name, & formatted[ ..boundary] ) ?;
145146 write ! ( writer, "..." )
146147 } else {
147148 write ! ( writer, "{}={formatted}" , field_name)
@@ -201,7 +202,8 @@ pub fn init_foreground_tracing(
201202 let formatted = format ! ( "{value:?}" ) ;
202203 const MAX_MESSAGE_CHARS : usize = 280 ;
203204 if formatted. len ( ) > MAX_MESSAGE_CHARS {
204- write ! ( writer, "{}={}" , field_name, & formatted[ ..MAX_MESSAGE_CHARS ] ) ?;
205+ let boundary = formatted. floor_char_boundary ( MAX_MESSAGE_CHARS ) ;
206+ write ! ( writer, "{}={}" , field_name, & formatted[ ..boundary] ) ?;
205207 write ! ( writer, "..." )
206208 } else {
207209 write ! ( writer, "{}={formatted}" , field_name)
You can’t perform that action at this time.
0 commit comments