@@ -124,13 +124,14 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
124124 // Apply colors so the abbreviation matches the visual style of engine logs.
125125 // try/finally guarantees the original colors are restored even if Write throws,
126126 // otherwise the console would be left tinted (e.g. red on error) for subsequent output.
127+ string mcpTimestamp = DateTime . UtcNow . ToString ( "yyyy-MM-dd'T'HH:mm:ss.fff'Z'" ) ;
127128 ConsoleColor mcpOriginalForeGroundColor = Console . ForegroundColor ;
128129 ConsoleColor mcpOriginalBackGroundColor = Console . BackgroundColor ;
129130 try
130131 {
131132 Console . ForegroundColor = _logLevelToForeGroundConsoleColorMap . GetValueOrDefault ( logLevel , ConsoleColor . White ) ;
132133 Console . BackgroundColor = _logLevelToBackGroundConsoleColorMap . GetValueOrDefault ( logLevel , ConsoleColor . Black ) ;
133- Console . Error . Write ( $ "{ mcpAbbreviation } :") ;
134+ Console . Error . Write ( $ "{ mcpTimestamp } { mcpAbbreviation } :") ;
134135 }
135136 finally
136137 {
@@ -153,6 +154,7 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
153154 }
154155
155156 TextWriter writer = logLevel >= LogLevel . Error ? Console . Error : Console . Out ;
157+ string timestamp = DateTime . UtcNow . ToString ( "yyyy-MM-dd'T'HH:mm:ss.fff'Z'" ) ;
156158 // try/finally guarantees the original colors are restored even if Write throws,
157159 // otherwise the console would be left tinted (e.g. red on error) for subsequent output.
158160 ConsoleColor originalForeGroundColor = Console . ForegroundColor ;
@@ -161,7 +163,7 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
161163 {
162164 Console . ForegroundColor = _logLevelToForeGroundConsoleColorMap . GetValueOrDefault ( logLevel , ConsoleColor . White ) ;
163165 Console . BackgroundColor = _logLevelToBackGroundConsoleColorMap . GetValueOrDefault ( logLevel , ConsoleColor . Black ) ;
164- writer . Write ( $ "{ abbreviation } :") ;
166+ writer . Write ( $ "{ timestamp } { abbreviation } :") ;
165167 }
166168 finally
167169 {
0 commit comments