Migrate to structured logging
This commit is contained in:
1 parent
0367d5001b
commit
0baf6cadf7
13 files changed
+202
-30
No files matched your search
@@ -1,5 +1,6 @@
|
||||
use crate::dictionary::app_data_dir;
|
||||
use std::io;
|
||||
use log::info;
|
||||
use reqwest::Error;
|
||||
use tokio::fs::{File, OpenOptions};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
@@ -72,7 +73,7 @@ pub fn decompress(data: Vec<u8>) -> Vec<u8> {
|
||||
let mut decompressed = Vec::new();
|
||||
let res = io::copy(&mut decoder, &mut decompressed);
|
||||
if let Err(e) = res {
|
||||
println!("{}", e);
|
||||
info!("{}", e);
|
||||
}
|
||||
decompressed
|
||||
}
|
||||
@@ -89,7 +90,7 @@ pub async fn first_sync() -> Result<String, NotificationData> {
|
||||
.text()
|
||||
.await
|
||||
.map_err(|_| WebApiUnavailable)?;
|
||||
println!("id: {}", id);
|
||||
info!("id: {}", id);
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
@@ -97,7 +98,7 @@ pub async fn get_web_version(key: &str) -> Result<u32, NotificationData> {
|
||||
let id_url = format!("{API_URL}{key}/version");
|
||||
let client = reqwest::Client::new();
|
||||
let version = client.get(&id_url).send().await.map_err(|_| WebApiUnavailable)?.text().await.map_err(|_| WebApiUnavailable)?;
|
||||
println!("version: {}", version);
|
||||
info!("version: {}", version);
|
||||
Ok(version.parse::<u32>().unwrap_or_default())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user