@@ -19,7 +19,7 @@ struct LoggerInner {
19
19
20
20
struct StoredRecord {
21
21
level : log:: Level ,
22
- time : chrono:: DateTime < chrono:: Local > ,
22
+ time : chrono:: DateTime < chrono:: Utc > ,
23
23
mod_path : String ,
24
24
text : String ,
25
25
}
@@ -70,7 +70,12 @@ impl Logger {
70
70
for stored_record in std:: mem:: take ( & mut inner. stored_records ) {
71
71
println ! (
72
72
"[{} {} {}] {}" ,
73
- stored_record. time, stored_record. level, stored_record. mod_path, stored_record. text
73
+ stored_record
74
+ . time
75
+ . to_rfc3339_opts( chrono:: SecondsFormat :: Secs , true ) ,
76
+ stored_record. level,
77
+ stored_record. mod_path,
78
+ stored_record. text
74
79
) ;
75
80
}
76
81
}
@@ -99,7 +104,7 @@ impl log::Log for Logger {
99
104
let mod_path = record. module_path ( ) . unwrap_or ( "" ) ;
100
105
inner. stored_records . push ( StoredRecord {
101
106
level : record. level ( ) ,
102
- time : chrono:: Local :: now ( ) ,
107
+ time : chrono:: Utc :: now ( ) ,
103
108
mod_path : mod_path. to_owned ( ) ,
104
109
text : record. args ( ) . to_string ( ) ,
105
110
} ) ;
@@ -193,7 +198,11 @@ impl TestResult {
193
198
194
199
macro_rules! println_with_time {
195
200
( $fmt: tt$( , $( $args: tt) * ) ?) => {
196
- println!( concat!( "[{}] " , $fmt) , chrono:: Local :: now( ) , $( $( $args) * ) ?)
201
+ println!(
202
+ concat!( "[{}] " , $fmt) ,
203
+ chrono:: Utc :: now( ) . to_rfc3339_opts( chrono:: SecondsFormat :: Secs , true ) ,
204
+ $( $( $args) * ) ?
205
+ )
197
206
} ;
198
207
}
199
208
0 commit comments