File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -143,23 +143,17 @@ where
143143 // https://github.com/tokio-rs/tracing/blob/efc690fa6bd1d9c3a57528b9bc8ac80504a7a6ed/tracing-subscriber/src/fmt/format/json.rs#L306
144144 if self . with_thread_names {
145145 let current_thread = std:: thread:: current ( ) ;
146- match current_thread. name ( ) {
147- Some ( name) => {
148- serializer. serialize_entry ( "thread.name" , name) ?;
149- }
146+ if let Some ( name) = current_thread. name ( ) {
147+ serializer. serialize_entry ( "thread.name" , name) ?;
148+ } else if !self . with_thread_ids {
150149 // fall-back to thread id when name is absent and ids are not enabled
151- None if !self . with_thread_ids => {
152- serializer. serialize_entry (
153- "thread.name" ,
154- & format ! ( "{:?}" , current_thread. id( ) ) ,
155- ) ?;
156- }
157- _ => { }
150+ serializer
151+ . serialize_entry ( "thread_name" , & format ! ( "{:?}" , current_thread. id( ) ) ) ?;
158152 }
159153 }
160154
161155 if self . with_thread_ids {
162- serializer. serialize_entry_no_quote ( "thread.id " , std:: thread:: current ( ) . id ( ) ) ?;
156+ serializer. serialize_entry_no_quote ( "thread_id " , std:: thread:: current ( ) . id ( ) ) ?;
163157 }
164158
165159 let span = if self . with_span_name || self . with_span_path {
You can’t perform that action at this time.
0 commit comments