Commit f66dc7e 1 parent 95bb6fe commit f66dc7e Copy full SHA for f66dc7e
File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -2,32 +2,29 @@ use std::path::PathBuf;
2
2
3
3
use tracing:: debug;
4
4
use tracing_appender:: non_blocking:: WorkerGuard ;
5
- use tracing_subscriber:: fmt:: format:: FmtSpan ;
6
5
use tracing_subscriber:: { self } ;
7
6
8
7
pub fn init_tracing ( log_path : PathBuf ) -> anyhow:: Result < Guard > {
9
- debug ! ( path = %log_path. display( ) , "Initializing logging system" ) ;
8
+ debug ! ( path = %log_path. display( ) , "Initializing logging system in JSON format " ) ;
10
9
11
10
let append = tracing_appender:: rolling:: daily ( log_path, "forge.log" ) ;
12
11
let ( non_blocking, guard) = tracing_appender:: non_blocking ( append) ;
13
12
14
13
tracing_subscriber:: fmt ( )
15
- . pretty ( )
14
+ . json ( )
16
15
. with_env_filter (
17
16
tracing_subscriber:: EnvFilter :: try_from_env ( "FORGE_LOG" )
18
17
. unwrap_or_else ( |_| tracing_subscriber:: EnvFilter :: new ( "forge=debug" ) ) ,
19
18
)
20
19
. with_timer ( tracing_subscriber:: fmt:: time:: uptime ( ) )
21
20
. with_thread_ids ( false )
22
- . with_target ( true )
21
+ . with_target ( false )
23
22
. with_file ( true )
24
23
. with_line_number ( true )
25
- . with_ansi ( true )
26
- . with_span_events ( FmtSpan :: ACTIVE )
27
24
. with_writer ( non_blocking)
28
25
. init ( ) ;
29
26
30
- debug ! ( "Logging system initialized successfully" ) ;
27
+ debug ! ( "JSON logging system initialized successfully" ) ;
31
28
Ok ( Guard ( guard) )
32
29
}
33
30
You can’t perform that action at this time.
0 commit comments