File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,4 @@ libc = "0.2.92"
24
24
tokio = { version = " 1" , features = [" macros" ] }
25
25
log = " 0.4.0"
26
26
tracing = " 0.1"
27
- tracing-subscriber = " 0.3"
27
+ tracing-subscriber = { version = " 0.3" , features = [ " env-filter " ] }
Original file line number Diff line number Diff line change 5
5
use anyhow:: Result ;
6
6
7
7
async fn run ( ) -> Result < ( ) > {
8
- tracing_subscriber:: fmt:: init ( ) ;
8
+ // Don't include timestamps and such because they're not really useful and
9
+ // too verbose, and plus several log targets such as journald will already
10
+ // include timestamps.
11
+ let format = tracing_subscriber:: fmt:: format ( )
12
+ . without_time ( )
13
+ . with_target ( false )
14
+ . compact ( ) ;
15
+ // Log to stderr by default
16
+ tracing_subscriber:: fmt ( )
17
+ . with_env_filter ( tracing_subscriber:: EnvFilter :: from_default_env ( ) )
18
+ . event_format ( format)
19
+ . with_writer ( std:: io:: stderr)
20
+ . init ( ) ;
9
21
tracing:: trace!( "starting" ) ;
10
22
bootc_lib:: cli:: run_from_iter ( std:: env:: args ( ) ) . await
11
23
}
12
24
13
25
#[ tokio:: main( flavor = "current_thread" ) ]
14
26
async fn main ( ) {
15
27
if let Err ( e) = run ( ) . await {
16
- eprintln ! ( "error: {:#}" , e) ;
28
+ tracing :: error !( "{:#}" , e) ;
17
29
std:: process:: exit ( 1 ) ;
18
30
}
19
31
}
You can’t perform that action at this time.
0 commit comments