@@ -150,9 +150,26 @@ enum LoadingMsg {
150
150
/// surface (since we would only want to surface fatal errors in non-interactive mode).
151
151
#[ derive( Clone , Debug ) ]
152
152
pub 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
+ }
156
173
}
157
174
158
175
pub struct ToolManagerBuilder {
@@ -815,7 +832,7 @@ impl ToolManager {
815
832
. lock ( )
816
833
. await
817
834
. iter ( )
818
- . any ( |( _, records) | records. iter ( ) . any ( |record| matches ! ( record, LoadingRecord :: Err ( _ ) ) ) )
835
+ . any ( |( _, records) | records. iter ( ) . any ( |record| matches ! ( record, LoadingRecord :: Err ( .. ) ) ) )
819
836
{
820
837
queue ! (
821
838
stderr,
@@ -963,7 +980,7 @@ impl ToolManager {
963
980
if !conflicts. is_empty ( ) {
964
981
let mut record_lock = self . mcp_load_record . lock ( ) . await ;
965
982
for ( server_name, msg) in conflicts {
966
- let record = LoadingRecord :: Err ( msg) ;
983
+ let record = LoadingRecord :: err ( msg) ;
967
984
record_lock
968
985
. entry ( server_name)
969
986
. and_modify ( |v| v. push ( record. clone ( ) ) )
@@ -1495,9 +1512,9 @@ fn spawn_orchestrator_task(
1495
1512
drop ( buf_writer) ;
1496
1513
let record = String :: from_utf8_lossy ( record_temp_buf) . to_string ( ) ;
1497
1514
let record = if process_result. is_err ( ) {
1498
- LoadingRecord :: Warn ( record)
1515
+ LoadingRecord :: warn ( record)
1499
1516
} else {
1500
- LoadingRecord :: Success ( record)
1517
+ LoadingRecord :: success ( record)
1501
1518
} ;
1502
1519
load_record
1503
1520
. lock ( )
@@ -1523,7 +1540,7 @@ fn spawn_orchestrator_task(
1523
1540
let _ = buf_writer. flush ( ) ;
1524
1541
drop ( buf_writer) ;
1525
1542
let record = String :: from_utf8_lossy ( record_temp_buf) . to_string ( ) ;
1526
- let record = LoadingRecord :: Err ( record) ;
1543
+ let record = LoadingRecord :: err ( record) ;
1527
1544
load_record
1528
1545
. lock ( )
1529
1546
. await
@@ -1607,7 +1624,7 @@ fn spawn_orchestrator_task(
1607
1624
let _ = buf_writer. flush ( ) ;
1608
1625
drop ( buf_writer) ;
1609
1626
let record = String :: from_utf8_lossy ( record_temp_buf) . to_string ( ) ;
1610
- let record = LoadingRecord :: Err ( record) ;
1627
+ let record = LoadingRecord :: err ( record) ;
1611
1628
load_record
1612
1629
. lock ( )
1613
1630
. await
@@ -1627,7 +1644,7 @@ fn spawn_orchestrator_task(
1627
1644
let _ = buf_writer. flush ( ) ;
1628
1645
drop ( buf_writer) ;
1629
1646
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 ( ) ) ;
1631
1648
load_record
1632
1649
. lock ( )
1633
1650
. await
0 commit comments