pub fn initialize_logging() -> Result<()>Expand description
Initialize logging with environment filter
Examples found in repository?
More examples
examples/complete.rs (line 63)
59async fn main() -> Result<()> {
60 let args = Args::parse();
61
62 load_dotenv_from_file("examples/.env.example")?;
63 initialize_logging()?;
64
65 let credentials = load_credentials()?;
66 let decoder = create_decoder()?;
67
68 let (pcm_tx, pcm_rx) = bounded::<Vec<i16>>(PCM_CHANNEL_CAPACITY);
69 let pcm_rx = Arc::new(Mutex::new(pcm_rx));
70 let _stream = setup_audio_output(pcm_rx)?;
71
72 let mut client = connect_to_zello(&credentials).await?;
73
74 match (args.message, args.callsign) {
75 (Some(msg), Some(callsign)) => {
76 client
77 .send_text_message_to_callsign(&msg, &callsign)
78 .await?;
79 }
80 (Some(msg), None) => {
81 client.send_text_message(&msg).await?;
82 }
83 (None, _) => {
84 client.run_message_loop(decoder, &pcm_tx).await?;
85 }
86 }
87
88 client.close().await?;
89
90 Ok(())
91}