@@ -6,13 +6,14 @@ use std::sync::Arc;
66use std:: task:: { RawWaker , RawWakerVTable } ;
77use std:: thread:: { self , Thread } ;
88
9- use super :: log_utils;
109use super :: pool;
1110use super :: task;
1211use crate :: future:: Future ;
1312use crate :: task:: { Context , Poll , Waker } ;
1413use crate :: utils:: abort_on_panic;
1514
15+ use kv_log_macro:: trace;
16+
1617/// Spawns a task and blocks the current thread on its result.
1718///
1819/// Calling this function is similar to [spawning] a thread and immediately [joining] it, except an
@@ -58,13 +59,11 @@ where
5859 // Log this `block_on` operation.
5960 let child_id = tag. task_id ( ) . as_u64 ( ) ;
6061 let parent_id = pool:: get_task ( |t| t. id ( ) . as_u64 ( ) ) . unwrap_or ( 0 ) ;
61- log_utils:: print (
62- format_args ! ( "block_on" ) ,
63- log_utils:: LogData {
64- parent_id,
65- child_id,
66- } ,
67- ) ;
62+
63+ trace ! ( "block_on" , {
64+ parent_id: parent_id,
65+ child_id: child_id,
66+ } ) ;
6867
6968 // Wrap the future into one that drops task-local variables on exit.
7069 let future = async move {
@@ -73,13 +72,11 @@ where
7372 // Abort on panic because thread-local variables behave the same way.
7473 abort_on_panic ( || pool:: get_task ( |task| task. metadata ( ) . local_map . clear ( ) ) ) ;
7574
76- log_utils:: print (
77- format_args ! ( "block_on completed" ) ,
78- log_utils:: LogData {
79- parent_id,
80- child_id,
81- } ,
82- ) ;
75+ trace ! ( "block_on completed" , {
76+ parent_id: parent_id,
77+ child_id: child_id,
78+ } ) ;
79+
8380 res
8481 } ;
8582
0 commit comments