From 5c70961cea34ac92658b59254bc3ef428ca7fa91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 20 Jul 2022 10:45:50 +0200 Subject: [PATCH] session: Add useful logs --- src/session/mod.rs | 9 ++++++++- src/window.rs | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/session/mod.rs b/src/session/mod.rs index ecc754d4..8da698a5 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -488,7 +488,7 @@ impl Session { None } Err(error) => { - error!("Failed to prepare the session: {}", error); + error!("Failed to prepare the session: {:?}", error); priv_.logout_on_dispose.set(false); @@ -503,6 +503,11 @@ impl Session { let sender = self.create_new_sync_response_sender(); let client = self.client(); let handle = spawn_tokio!(async move { + let sync_token = client.sync_token().await; + if sync_token.is_none() { + debug!("Proceeding to initial sync…"); + } + // TODO: only create the filter once and reuse it in the future let room_event_filter = assign!(RoomEventFilter::default(), { lazy_load_options: LazyLoadOptions::Enabled {include_redundant_members: false}, @@ -564,6 +569,7 @@ impl Session { let priv_ = obj.imp(); if !obj.has_cross_signing_keys().await { if need_new_identity.await.unwrap() { + debug!("No E2EE identity found for this user, we need to create a new one…"); let encryption = obj.client().encryption(); let handle = spawn_tokio!(async move { encryption.bootstrap_cross_signing(None).await }); @@ -576,6 +582,7 @@ impl Session { } } + debug!("The cross-signing keys were not found, we need to verify this session…"); priv_.logout_on_dispose.set(true); obj.create_session_verification().await; diff --git a/src/window.rs b/src/window.rs index b32cb845..68e13cdc 100644 --- a/src/window.rs +++ b/src/window.rs @@ -2,7 +2,7 @@ use adw::subclass::prelude::AdwApplicationWindowImpl; use gettextrs::gettext; use glib::signal::Inhibit; use gtk::{self, gdk, gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate}; -use log::warn; +use log::{info, warn}; use crate::{ account_switcher::AccountSwitcher, @@ -197,6 +197,14 @@ impl Window { self.switch_to_greeter_page(false); } else { for stored_session in sessions { + info!( + "Restoring previous session for user: {}", + stored_session.user_id + ); + if let Some(path) = stored_session.path.to_str() { + info!("Database path: {path}"); + } + let session = Session::new(); spawn!( glib::PRIORITY_DEFAULT_IDLE,