[fractal] session: Add useful logs



commit 5c70961cea34ac92658b59254bc3ef428ca7fa91
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Wed Jul 20 10:45:50 2022 +0200

    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 ecc754d45..8da698a55 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 b32cb8458..68e13cdce 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]