@@ -150,9 +150,26 @@ enum LoadingMsg {
150150/// surface (since we would only want to surface fatal errors in non-interactive mode).
151151#[ derive( Clone , Debug ) ]
152152pub enum LoadingRecord {
153- Success ( String ) ,
154- Warn ( String ) ,
155- Err ( String ) ,
153+ Success ( String , String ) ,
154+ Warn ( String , String ) ,
155+ Err ( String , String ) ,
156+ }
157+
158+ impl LoadingRecord {
159+ pub fn success ( msg : String ) -> Self {
160+ let timestamp = chrono:: Local :: now ( ) . format ( "%Y:%H:%S" ) . to_string ( ) ;
161+ LoadingRecord :: Success ( timestamp, msg)
162+ }
163+
164+ pub fn warn ( msg : String ) -> Self {
165+ let timestamp = chrono:: Local :: now ( ) . format ( "%Y:%H:%S" ) . to_string ( ) ;
166+ LoadingRecord :: Warn ( timestamp, msg)
167+ }
168+
169+ pub fn err ( msg : String ) -> Self {
170+ let timestamp = chrono:: Local :: now ( ) . format ( "%Y:%H:%S" ) . to_string ( ) ;
171+ LoadingRecord :: Err ( timestamp, msg)
172+ }
156173}
157174
158175pub struct ToolManagerBuilder {
@@ -815,7 +832,7 @@ impl ToolManager {
815832 . lock ( )
816833 . await
817834 . iter ( )
818- . any ( |( _, records) | records. iter ( ) . any ( |record| matches ! ( record, LoadingRecord :: Err ( _ ) ) ) )
835+ . any ( |( _, records) | records. iter ( ) . any ( |record| matches ! ( record, LoadingRecord :: Err ( .. ) ) ) )
819836 {
820837 queue ! (
821838 stderr,
@@ -963,7 +980,7 @@ impl ToolManager {
963980 if !conflicts. is_empty ( ) {
964981 let mut record_lock = self . mcp_load_record . lock ( ) . await ;
965982 for ( server_name, msg) in conflicts {
966- let record = LoadingRecord :: Err ( msg) ;
983+ let record = LoadingRecord :: err ( msg) ;
967984 record_lock
968985 . entry ( server_name)
969986 . and_modify ( |v| v. push ( record. clone ( ) ) )
@@ -1495,9 +1512,9 @@ fn spawn_orchestrator_task(
14951512 drop ( buf_writer) ;
14961513 let record = String :: from_utf8_lossy ( record_temp_buf) . to_string ( ) ;
14971514 let record = if process_result. is_err ( ) {
1498- LoadingRecord :: Warn ( record)
1515+ LoadingRecord :: warn ( record)
14991516 } else {
1500- LoadingRecord :: Success ( record)
1517+ LoadingRecord :: success ( record)
15011518 } ;
15021519 load_record
15031520 . lock ( )
@@ -1523,7 +1540,7 @@ fn spawn_orchestrator_task(
15231540 let _ = buf_writer. flush ( ) ;
15241541 drop ( buf_writer) ;
15251542 let record = String :: from_utf8_lossy ( record_temp_buf) . to_string ( ) ;
1526- let record = LoadingRecord :: Err ( record) ;
1543+ let record = LoadingRecord :: err ( record) ;
15271544 load_record
15281545 . lock ( )
15291546 . await
@@ -1607,7 +1624,7 @@ fn spawn_orchestrator_task(
16071624 let _ = buf_writer. flush ( ) ;
16081625 drop ( buf_writer) ;
16091626 let record = String :: from_utf8_lossy ( record_temp_buf) . to_string ( ) ;
1610- let record = LoadingRecord :: Err ( record) ;
1627+ let record = LoadingRecord :: err ( record) ;
16111628 load_record
16121629 . lock ( )
16131630 . await
@@ -1627,7 +1644,7 @@ fn spawn_orchestrator_task(
16271644 let _ = buf_writer. flush ( ) ;
16281645 drop ( buf_writer) ;
16291646 let record_str = String :: from_utf8_lossy ( record_temp_buf) . to_string ( ) ;
1630- let record = LoadingRecord :: Warn ( record_str. clone ( ) ) ;
1647+ let record = LoadingRecord :: warn ( record_str. clone ( ) ) ;
16311648 load_record
16321649 . lock ( )
16331650 . await
0 commit comments