@@ -2,33 +2,28 @@ use std::{collections::HashMap, fs};
22
33use cert_ext:: CertExt ;
44use clap:: Parser ;
5- use cli_args:: { Cli , GeneratePkcs12 } ;
5+ use cli_args:: { Cli , CliCommand , GeneratePkcs12 } ;
66use openssl:: x509:: X509 ;
77use snafu:: { ResultExt , ensure_whatever} ;
88use stackable_secret_operator_utils:: pkcs12:: pkcs12_truststore;
9- use tracing:: { info, level_filters:: LevelFilter , warn} ;
9+ use stackable_telemetry:: Tracing ;
10+ use tracing:: { info, warn} ;
1011
1112mod cert_ext;
1213mod cli_args;
1314mod parsers;
1415
1516#[ snafu:: report]
1617pub fn main ( ) -> Result < ( ) , snafu:: Whatever > {
17- let filter = tracing_subscriber:: EnvFilter :: builder ( )
18- . with_default_directive ( LevelFilter :: INFO . into ( ) )
19- . from_env ( )
20- . whatever_context ( "failed to create tracing subscriber EnvFilter" ) ?;
21- tracing_subscriber:: fmt ( )
22- // Short running tool does not need any complex output
23- . with_target ( false )
24- . without_time ( )
25- . with_env_filter ( filter)
26- . init ( ) ;
27-
2818 let cli = Cli :: parse ( ) ;
2919
30- match cli {
31- Cli :: GeneratePkcs12Truststore ( cli_args) => generate_pkcs12_truststore ( cli_args) ?,
20+ // Use `CONSOLE_LOG_LEVEL` to modify the console log level
21+ let _tracing_guard = Tracing :: pre_configured ( "cert-tools" , cli. telemetry )
22+ . init ( )
23+ . whatever_context ( "failed to initialize tracing" ) ?;
24+
25+ match cli. command {
26+ CliCommand :: GeneratePkcs12Truststore ( cli_args) => generate_pkcs12_truststore ( cli_args) ?,
3227 }
3328
3429 Ok ( ( ) )
0 commit comments