File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
src/tools/rust-analyzer/crates/rust-analyzer/src/tracing Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,22 @@ where
5858 let writer = self . writer ;
5959
6060 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- )
6561 . with_target ( false )
6662 . 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) ;
6977
7078 let chalk_layer = match self . chalk_filter {
7179 Some ( chalk_filter) => {
You can’t perform that action at this time.
0 commit comments