Migrate to structured logging
This commit is contained in:
1 parent
0367d5001b
commit
0baf6cadf7
13 files changed
+202
-30
No files matched your search
+11
-10
@@ -33,6 +33,7 @@ use parking_lot::Mutex;
|
||||
use rusqlite::Connection;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use log::info;
|
||||
|
||||
impl Default for ScreenState {
|
||||
fn default() -> Self {
|
||||
@@ -95,9 +96,9 @@ pub struct ScreenState {
|
||||
|
||||
impl ScreenState {
|
||||
pub fn boot() -> (ScreenState, Task<RootMessage>) {
|
||||
println!("Booting");
|
||||
info!("Booting");
|
||||
create_db();
|
||||
println!("Db created");
|
||||
info!("Db created");
|
||||
let state = ScreenState::default();
|
||||
let reading_additional_task = Task::perform(Self::load_additional_data(), |data| data);
|
||||
|
||||
@@ -128,7 +129,7 @@ impl ScreenState {
|
||||
}
|
||||
|
||||
drop(state_guard);
|
||||
println!("Boot finished");
|
||||
info!("Boot finished");
|
||||
(state, final_task)
|
||||
}
|
||||
|
||||
@@ -161,9 +162,9 @@ impl ScreenState {
|
||||
async fn load_web_backup(string: String) -> Result<bool, NotificationData> {
|
||||
let local = get_local_version().await;
|
||||
let web = get_web_version(string.as_str()).await?;
|
||||
println!("{} {}", local, web);
|
||||
info!("{} {}", local, web);
|
||||
if web > local {
|
||||
println!("Web version is newer than local version");
|
||||
info!("Web version is newer than local version");
|
||||
load_data(string, true).await?;
|
||||
set_local_version(web).await;
|
||||
} else {
|
||||
@@ -173,7 +174,7 @@ impl ScreenState {
|
||||
}
|
||||
|
||||
pub fn update(&mut self, message: RootMessage) -> Task<RootMessage> {
|
||||
println!("Updating");
|
||||
info!("Updating");
|
||||
let time = Instant::now();
|
||||
if let Keyboard(e) = message {
|
||||
return self.handle_keyboard(e);
|
||||
@@ -185,7 +186,7 @@ impl ScreenState {
|
||||
}
|
||||
|
||||
if let UpdateData = message {
|
||||
println!("Loading data");
|
||||
info!("Loading data");
|
||||
let mut state = self.app_state.lock();
|
||||
if cfg!(windows) {
|
||||
state.connection = Connection::open_in_memory().unwrap();
|
||||
@@ -228,7 +229,7 @@ impl ScreenState {
|
||||
Import
|
||||
);
|
||||
}
|
||||
println!("Update took {:?}", time.elapsed());
|
||||
info!("Update took {:?}", time.elapsed());
|
||||
|
||||
task.0
|
||||
}
|
||||
@@ -255,7 +256,7 @@ impl ScreenState {
|
||||
|
||||
pub fn view(&self) -> Element<'_, RootMessage> {
|
||||
|
||||
println!("View update");
|
||||
info!("View update");
|
||||
let time = Instant::now();
|
||||
let view = view_navigation!(
|
||||
self.stack,
|
||||
@@ -276,7 +277,7 @@ impl ScreenState {
|
||||
|
||||
let notifications = self.notification_manager.draw().map(RootMessage::Notification);
|
||||
|
||||
println!("View took {:?}", time.elapsed());
|
||||
info!("View took {:?}", time.elapsed());
|
||||
stack![view, notifications].width(Fill).height(Fill).into()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user