File tree 1 file changed +14
-6
lines changed
src/tools/rust-analyzer/crates/rust-analyzer/src/tracing
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,22 @@ where
58
58
let writer = self . writer ;
59
59
60
60
let ra_fmt_layer = tracing_subscriber:: fmt:: layer ( )
61
- . with_timer (
62
- time:: OffsetTime :: local_rfc_3339 ( )
63
- . expect ( "Could not get local offset, make sure you're on the main thread" ) ,
64
- )
65
61
. with_target ( false )
66
62
. with_ansi ( false )
67
- . with_writer ( writer)
68
- . with_filter ( targets_filter) ;
63
+ . with_writer ( writer) ;
64
+
65
+ let ra_fmt_layer = match time:: OffsetTime :: local_rfc_3339 ( ) {
66
+ Ok ( timer) => {
67
+ // If we can get the time offset, format logs with the timezone.
68
+ ra_fmt_layer. with_timer ( timer) . boxed ( )
69
+ }
70
+ Err ( _) => {
71
+ // Use system time if we can't get the time offset. This should
72
+ // never happen on Linux, but can happen on e.g. OpenBSD.
73
+ ra_fmt_layer. boxed ( )
74
+ }
75
+ }
76
+ . with_filter ( targets_filter) ;
69
77
70
78
let chalk_layer = match self . chalk_filter {
71
79
Some ( chalk_filter) => {
You can’t perform that action at this time.
0 commit comments