session: Add useful logs

This commit is contained in:
Kévin Commaille 2022-07-20 10:45:50 +02:00
parent 58faca5e38
commit 5c70961cea
No known key found for this signature in database
GPG key ID: DD507DAE96E8245C
2 changed files with 17 additions and 2 deletions

View file

@ -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;

View file

@ -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,