From 97de17ce62c8de5a290c5d0a92c1f4b42993dd01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Tue, 25 Jul 2023 14:36:26 +0200 Subject: [PATCH] misc: Use tracing for logging --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/application.rs | 2 +- src/components/auth_dialog.rs | 2 +- src/components/context_menu_bin.rs | 2 +- src/components/editable_avatar.rs | 2 +- src/components/image_paintable.rs | 2 +- src/components/media_content_viewer.rs | 2 +- src/components/scale_revealer.rs | 5 +++-- src/components/video_player.rs | 2 +- src/contrib/qr_code_scanner/camera_paintable.rs | 3 ++- src/contrib/qr_code_scanner/qr_code_detector.rs | 2 +- src/error_page.rs | 2 +- src/login/homeserver_page.rs | 2 +- src/login/method_page.rs | 2 +- src/login/mod.rs | 2 +- src/secret.rs | 2 +- src/session/model/avatar/data.rs | 3 ++- src/session/model/avatar/image.rs | 2 +- src/session/model/notifications.rs | 2 +- src/session/model/room/member.rs | 5 +++-- src/session/model/room/mod.rs | 2 +- src/session/model/room/timeline/mod.rs | 2 +- src/session/model/room_list.rs | 2 +- src/session/model/session.rs | 2 +- src/session/model/settings.rs | 2 +- src/session/model/user.rs | 2 +- src/session/model/verification/identity_verification.rs | 2 +- src/session/model/verification/verification_list.rs | 2 +- .../view/account_settings/devices_page/device_list.rs | 2 +- src/session/view/account_settings/devices_page/device_row.rs | 2 +- src/session/view/account_settings/notifications_page.rs | 2 +- .../security_page/import_export_keys_subpage.rs | 2 +- .../account_settings/user_page/change_password_subpage.rs | 2 +- .../account_settings/user_page/deactivate_account_subpage.rs | 2 +- src/session/view/account_settings/user_page/mod.rs | 2 +- src/session/view/content/explore/public_room_list.rs | 2 +- src/session/view/content/explore/server_list.rs | 2 +- src/session/view/content/room_details/general_page/mod.rs | 2 +- .../view/content/room_details/history_viewer/audio_row.rs | 2 +- .../view/content/room_details/history_viewer/file_row.rs | 4 ++-- .../view/content/room_details/history_viewer/media.rs | 2 +- .../view/content/room_details/history_viewer/media_item.rs | 2 +- .../view/content/room_details/history_viewer/timeline.rs | 2 +- .../view/content/room_details/invite_subpage/invitee_list.rs | 2 +- src/session/view/content/room_details/member_page/mod.rs | 2 +- src/session/view/content/room_details/mod.rs | 2 +- src/session/view/content/room_history/event_actions.rs | 2 +- src/session/view/content/room_history/message_row/audio.rs | 2 +- src/session/view/content/room_history/message_row/content.rs | 2 +- .../view/content/room_history/message_row/location.rs | 2 +- src/session/view/content/room_history/message_row/media.rs | 2 +- src/session/view/content/room_history/mod.rs | 2 +- src/session/view/content/room_history/state_row/mod.rs | 2 +- .../content/verification/identity_verification_widget.rs | 2 +- .../view/content/verification/session_verification.rs | 2 +- src/session/view/create_dm_dialog/dm_user.rs | 2 +- src/session/view/create_dm_dialog/dm_user_list.rs | 2 +- src/session/view/media_viewer.rs | 2 +- src/session/view/room_creation.rs | 2 +- src/session/view/session_view.rs | 2 +- src/session/view/sidebar/mod.rs | 2 +- src/utils/expression_list_model.rs | 2 +- src/utils/media.rs | 2 +- src/utils/mod.rs | 3 ++- src/window.rs | 2 +- 66 files changed, 74 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5eb0a7c4..a01baba4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1359,7 +1359,6 @@ dependencies = [ "indexmap 2.0.0", "libadwaita", "libshumate", - "log", "matrix-sdk", "matrix-sdk-ui", "mime", @@ -1380,6 +1379,7 @@ dependencies = [ "strum", "thiserror", "tokio", + "tracing", "tracing-subscriber", "url", ] diff --git a/Cargo.toml b/Cargo.toml index ea0134ae..9f9fb9a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,6 @@ html-escape = "0.2" html2pango = "0.5" image = "0.24" indexmap = "2" -log = "0.4" mime = "0.3" mime_guess = "2" once_cell = "1" @@ -63,6 +62,7 @@ serde_json = "1" strum = { version = "0.24", features = ["derive"] } thiserror = "1" tokio = { version = "1", features = ["rt", "rt-multi-thread", "sync"] } +tracing = "0.1" tracing-subscriber = "0.3" url = "2" diff --git a/src/application.rs b/src/application.rs index 1322f799..6601bc41 100644 --- a/src/application.rs +++ b/src/application.rs @@ -4,8 +4,8 @@ use gettextrs::gettext; use gio::{ApplicationFlags, Settings}; use glib::{clone, WeakRef}; use gtk::{gio, glib, prelude::*, subclass::prelude::*}; -use log::{debug, info}; use ruma::{OwnedRoomId, RoomId}; +use tracing::{debug, info}; use crate::{config, Window}; diff --git a/src/components/auth_dialog.rs b/src/components/auth_dialog.rs index 19706da0..560854cd 100644 --- a/src/components/auth_dialog.rs +++ b/src/components/auth_dialog.rs @@ -8,7 +8,6 @@ use gtk::{ prelude::*, CompositeTemplate, }; -use log::error; use matrix_sdk::Error; use ruma::{ api::client::{ @@ -18,6 +17,7 @@ use ruma::{ assign, }; use thiserror::Error; +use tracing::error; use crate::{prelude::*, session::model::Session, spawn, spawn_tokio}; diff --git a/src/components/context_menu_bin.rs b/src/components/context_menu_bin.rs index cff7438e..3a3b55a0 100644 --- a/src/components/context_menu_bin.rs +++ b/src/components/context_menu_bin.rs @@ -1,6 +1,6 @@ use adw::subclass::prelude::*; use gtk::{gdk, glib, glib::clone, prelude::*, CompositeTemplate}; -use log::debug; +use tracing::debug; mod imp { use std::cell::RefCell; diff --git a/src/components/editable_avatar.rs b/src/components/editable_avatar.rs index 760ac085..c7a1cb9d 100644 --- a/src/components/editable_avatar.rs +++ b/src/components/editable_avatar.rs @@ -8,7 +8,7 @@ use gtk::{ prelude::*, CompositeTemplate, }; -use log::{debug, error}; +use tracing::{debug, error}; use super::{ActionButton, ActionState, ImagePaintable}; use crate::{ diff --git a/src/components/image_paintable.rs b/src/components/image_paintable.rs index 2ef6d6a5..cce20548 100644 --- a/src/components/image_paintable.rs +++ b/src/components/image_paintable.rs @@ -9,7 +9,7 @@ use image::{ flat::SampleLayout, AnimationDecoder, DynamicImage, ImageFormat, }; -use log::error; +use tracing::error; /// A single frame of an animation. pub struct Frame { diff --git a/src/components/media_content_viewer.rs b/src/components/media_content_viewer.rs index 96d5725d..62961ece 100644 --- a/src/components/media_content_viewer.rs +++ b/src/components/media_content_viewer.rs @@ -2,7 +2,7 @@ use adw::{prelude::*, subclass::prelude::*}; use geo_uri::GeoUri; use gettextrs::gettext; use gtk::{gdk, gio, glib, glib::clone, CompositeTemplate}; -use log::warn; +use tracing::warn; use super::{AudioPlayer, ImagePaintable, LocationViewer, Spinner}; use crate::spawn; diff --git a/src/components/scale_revealer.rs b/src/components/scale_revealer.rs index 7ed96627..9ab6ad03 100644 --- a/src/components/scale_revealer.rs +++ b/src/components/scale_revealer.rs @@ -1,5 +1,6 @@ use adw::{prelude::*, subclass::prelude::*}; use gtk::{gdk, glib, graphene}; +use tracing::warn; const ANIMATION_DURATION: u32 = 250; @@ -115,7 +116,7 @@ mod imp { .upgrade() .and_then(|s| s.compute_bounds(&*obj)) .unwrap_or_else(|| { - log::warn!( + warn!( "The source widget bounds could not be calculated, using default bounds as fallback" ); graphene::Rect::new(0.0, 0.0, 100.0, 100.0) @@ -159,7 +160,7 @@ mod imp { ); } } else { - log::warn!("The source widget texture is None, using child snapshot as fallback"); + warn!("The source widget texture is None, using child snapshot as fallback"); obj.snapshot_child(&child, snapshot); } } diff --git a/src/components/video_player.rs b/src/components/video_player.rs index 792765d1..ceb02b14 100644 --- a/src/components/video_player.rs +++ b/src/components/video_player.rs @@ -2,7 +2,7 @@ use adw::subclass::prelude::*; use gst::ClockTime; use gst_play::{Play as GstPlay, PlayMessage}; use gtk::{gio, glib, glib::clone, prelude::*, CompositeTemplate}; -use log::{error, warn}; +use tracing::{error, warn}; use super::VideoPlayerRenderer; diff --git a/src/contrib/qr_code_scanner/camera_paintable.rs b/src/contrib/qr_code_scanner/camera_paintable.rs index 2185d42a..7994fa97 100644 --- a/src/contrib/qr_code_scanner/camera_paintable.rs +++ b/src/contrib/qr_code_scanner/camera_paintable.rs @@ -25,6 +25,7 @@ use gtk::{ subclass::prelude::*, }; use matrix_sdk::encryption::verification::QrVerificationData; +use tracing::error; use crate::contrib::qr_code_scanner::{qr_code_detector::QrCodeDetector, QrVerificationDataBoxed}; @@ -192,7 +193,7 @@ impl CameraPaintable { bus.add_watch_local( clone!(@weak self as paintable => @default-return glib::Continue(false), move |_, msg| { if let gst::MessageView::Error(err) = msg.view() { - log::error!( + error!( "Error from {:?}: {} ({:?})", err.src().map(|s| s.path_string()), err.error(), diff --git a/src/contrib/qr_code_scanner/qr_code_detector.rs b/src/contrib/qr_code_scanner/qr_code_detector.rs index 960b30c7..11537f0e 100644 --- a/src/contrib/qr_code_scanner/qr_code_detector.rs +++ b/src/contrib/qr_code_scanner/qr_code_detector.rs @@ -3,9 +3,9 @@ use std::convert::AsRef; use glib::Sender; use gst_video::{video_frame::VideoFrameRef, VideoInfo}; use image::{GenericImage, GenericImageView, Luma}; -use log::debug; use matrix_sdk::encryption::verification::{DecodingError, QrVerificationData}; use thiserror::Error; +use tracing::debug; use super::*; use crate::contrib::qr_code_scanner::camera_paintable::Action; diff --git a/src/error_page.rs b/src/error_page.rs index 046d9644..575ab855 100644 --- a/src/error_page.rs +++ b/src/error_page.rs @@ -1,7 +1,7 @@ use adw::subclass::prelude::BinImpl; use gettextrs::gettext; use gtk::{self, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate}; -use log::error; +use tracing::error; use crate::{spawn, toast, Window}; diff --git a/src/login/homeserver_page.rs b/src/login/homeserver_page.rs index 2945d6a8..e7a7e274 100644 --- a/src/login/homeserver_page.rs +++ b/src/login/homeserver_page.rs @@ -1,11 +1,11 @@ use adw::{prelude::*, subclass::prelude::BinImpl}; use gettextrs::gettext; use gtk::{self, glib, glib::clone, subclass::prelude::*, CompositeTemplate}; -use log::warn; use matrix_sdk::{ config::RequestConfig, sanitize_server_name, Client, ClientBuildError, ClientBuilder, }; use ruma::{api::client::discovery::get_supported_versions, OwnedServerName}; +use tracing::warn; use url::{ParseError, Url}; use super::Login; diff --git a/src/login/method_page.rs b/src/login/method_page.rs index 8fda4140..1d383e92 100644 --- a/src/login/method_page.rs +++ b/src/login/method_page.rs @@ -1,8 +1,8 @@ use adw::{prelude::*, subclass::prelude::BinImpl}; use gettextrs::gettext; use gtk::{self, glib, glib::clone, subclass::prelude::*, CompositeTemplate}; -use log::warn; use ruma::api::client::session::get_login_types::v3::LoginType; +use tracing::warn; use super::{idp_button::IdpButton, Login}; use crate::{ diff --git a/src/login/mod.rs b/src/login/mod.rs index ffb8835b..43f84d8f 100644 --- a/src/login/mod.rs +++ b/src/login/mod.rs @@ -1,13 +1,13 @@ use adw::{prelude::*, subclass::prelude::BinImpl}; use gettextrs::gettext; use gtk::{self, gio, glib, glib::clone, subclass::prelude::*, CompositeTemplate}; -use log::{error, warn}; use matrix_sdk::Client; use ruma::{ api::client::session::{get_login_types::v3::LoginType, login}, OwnedServerName, }; use strum::{AsRefStr, EnumString}; +use tracing::{error, warn}; use url::Url; mod advanced_dialog; diff --git a/src/secret.rs b/src/secret.rs index 9bd1e9ab..26188bd8 100644 --- a/src/secret.rs +++ b/src/secret.rs @@ -2,7 +2,6 @@ use std::{collections::HashMap, ffi::OsStr, fmt, fs, path::PathBuf, string::From use gettextrs::gettext; use gtk::glib; -use log::{debug, error, warn}; use matrix_sdk::{ matrix_auth::{Session as MatrixSession, SessionTokens}, SessionMeta, @@ -14,6 +13,7 @@ use ruma::{DeviceId, OwnedDeviceId, OwnedUserId, UserId}; use serde::{Deserialize, Serialize}; use serde_json::error::Error as JsonError; use thiserror::Error; +use tracing::{debug, error, warn}; use url::Url; use crate::{gettext_f, prelude::*, spawn_tokio, utils::matrix, APP_ID, PROFILE}; diff --git a/src/session/model/avatar/data.rs b/src/session/model/avatar/data.rs index f24872ff..cd2025de 100644 --- a/src/session/model/avatar/data.rs +++ b/src/session/model/avatar/data.rs @@ -1,4 +1,5 @@ use gtk::{gdk, glib, prelude::*, subclass::prelude::*}; +use tracing::warn; use super::AvatarImage; use crate::{ @@ -124,7 +125,7 @@ impl AvatarData { match icon { Ok(icon) => Some(icon), Err(error) => { - log::warn!("Failed to generate icon for notification: {error}"); + warn!("Failed to generate icon for notification: {error}"); None } } diff --git a/src/session/model/avatar/image.rs b/src/session/model/avatar/image.rs index 027a4109..2ebaccac 100644 --- a/src/session/model/avatar/image.rs +++ b/src/session/model/avatar/image.rs @@ -1,5 +1,4 @@ use gtk::{gdk, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::error; use matrix_sdk::{ media::{MediaFormat, MediaRequest, MediaThumbnailSize}, ruma::{ @@ -7,6 +6,7 @@ use matrix_sdk::{ OwnedMxcUri, }, }; +use tracing::error; use crate::{components::ImagePaintable, session::model::Session, spawn, spawn_tokio}; diff --git a/src/session/model/notifications.rs b/src/session/model/notifications.rs index 0e2a4a98..c2902242 100644 --- a/src/session/model/notifications.rs +++ b/src/session/model/notifications.rs @@ -1,9 +1,9 @@ use gtk::{gio, glib, prelude::*, subclass::prelude::*}; -use log::{debug, warn}; use ruma::{ api::client::push::get_notifications::v3::Notification, EventId, OwnedEventId, OwnedRoomId, RoomId, }; +use tracing::{debug, warn}; use super::{Room, Session}; use crate::{ diff --git a/src/session/model/room/member.rs b/src/session/model/room/member.rs index 98638c9d..5a4089b0 100644 --- a/src/session/model/room/member.rs +++ b/src/session/model/room/member.rs @@ -10,6 +10,7 @@ use matrix_sdk::{ OwnedMxcUri, UserId, }, }; +use tracing::error; use super::{ power_levels::{PowerLevel, POWER_LEVEL_MAX, POWER_LEVEL_MIN}, @@ -205,7 +206,7 @@ impl Member { /// Update the user based on the room member. pub fn update_from_room_member(&self, member: &RoomMember) { if member.user_id() != &*self.user_id() { - log::error!("Tried Member update from RoomMember with wrong user ID."); + error!("Tried Member update from RoomMember with wrong user ID."); return; }; @@ -220,7 +221,7 @@ impl Member { /// Update the user based on the room member state event pub fn update_from_member_event(&self, event: &impl MemberEvent) { if event.state_key() != &*self.user_id() { - log::error!("Tried Member update from MemberEvent with wrong user ID."); + error!("Tried Member update from MemberEvent with wrong user ID."); return; }; diff --git a/src/session/model/room/mod.rs b/src/session/model/room/mod.rs index 47e94d9d..205bb3e5 100644 --- a/src/session/model/room/mod.rs +++ b/src/session/model/room/mod.rs @@ -12,7 +12,6 @@ use std::{cell::RefCell, io::Cursor}; use gettextrs::gettext; use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::{debug, error, warn}; use matrix_sdk::{ attachment::{generate_image_thumbnail, AttachmentConfig, AttachmentInfo, Thumbnail}, deserialized_responses::{MemberEvent, SyncOrStrippedState, SyncTimelineEvent}, @@ -33,6 +32,7 @@ use ruma::{ }, OwnedEventId, OwnedRoomId, OwnedUserId, RoomId, }; +use tracing::{debug, error, warn}; pub use self::{ event::*, diff --git a/src/session/model/room/timeline/mod.rs b/src/session/model/room/timeline/mod.rs index edbf062f..e6d82a6f 100644 --- a/src/session/model/room/timeline/mod.rs +++ b/src/session/model/room/timeline/mod.rs @@ -6,7 +6,6 @@ use std::{collections::HashMap, sync::Arc}; use eyeball_im::VectorDiff; use futures_util::StreamExt; use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::{error, warn}; use matrix_sdk::Error as MatrixError; use matrix_sdk_ui::timeline::{ BackPaginationStatus, PaginationOptions, RoomExt, Timeline as SdkTimeline, @@ -19,6 +18,7 @@ use ruma::{ }, OwnedEventId, }; +use tracing::{error, warn}; pub use self::{ timeline_item::{TimelineItem, TimelineItemExt, TimelineItemImpl}, diff --git a/src/session/model/room_list.rs b/src/session/model/room_list.rs index f9f1847f..5edf3ee6 100644 --- a/src/session/model/room_list.rs +++ b/src/session/model/room_list.rs @@ -5,11 +5,11 @@ use std::{ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; use indexmap::map::IndexMap; -use log::error; use matrix_sdk::{ ruma::{OwnedRoomId, OwnedRoomOrAliasId, OwnedServerName, RoomAliasId, RoomId, RoomOrAliasId}, sync::Rooms as ResponseRooms, }; +use tracing::error; use crate::{ gettext_f, diff --git a/src/session/model/session.rs b/src/session/model/session.rs index c706410d..f5611e40 100644 --- a/src/session/model/session.rs +++ b/src/session/model/session.rs @@ -7,7 +7,6 @@ use gtk::{ self, gio, glib, glib::{clone, signal::SignalHandlerId}, }; -use log::{debug, error}; use matrix_sdk::{ config::SyncSettings, matrix_auth::Session as MatrixSession, room::Room as MatrixRoom, sync::SyncResponse, Client, @@ -25,6 +24,7 @@ use ruma::{ }, }; use tokio::task::JoinHandle; +use tracing::{debug, error}; use url::Url; use super::{ diff --git a/src/session/model/settings.rs b/src/session/model/settings.rs index facd8bfd..064775f5 100644 --- a/src/session/model/settings.rs +++ b/src/session/model/settings.rs @@ -1,7 +1,7 @@ use gtk::{glib, prelude::*, subclass::prelude::*}; use indexmap::IndexMap; -use log::error; use serde::{Deserialize, Serialize}; +use tracing::error; use crate::Application; diff --git a/src/session/model/user.rs b/src/session/model/user.rs index 83416bb3..bb884321 100644 --- a/src/session/model/user.rs +++ b/src/session/model/user.rs @@ -1,9 +1,9 @@ use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::error; use matrix_sdk::{ encryption::identities::UserIdentity, ruma::{OwnedMxcUri, OwnedUserId, UserId}, }; +use tracing::error; use crate::{ components::Pill, diff --git a/src/session/model/verification/identity_verification.rs b/src/session/model/verification/identity_verification.rs index d674d165..0730e938 100644 --- a/src/session/model/verification/identity_verification.rs +++ b/src/session/model/verification/identity_verification.rs @@ -1,7 +1,6 @@ use std::time::Duration; use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::{debug, error, warn}; use matrix_sdk::{ encryption::{ identities::RequestVerificationError, @@ -16,6 +15,7 @@ use matrix_sdk::{ use qrcode::QrCode; use ruma::events::key::verification::{REQUEST_RECEIVED_TIMEOUT, REQUEST_TIMESTAMP_TIMEOUT}; use tokio::sync::mpsc; +use tracing::{debug, error, warn}; use crate::{ contrib::Camera, diff --git a/src/session/model/verification/verification_list.rs b/src/session/model/verification/verification_list.rs index ba52708c..18073fbb 100644 --- a/src/session/model/verification/verification_list.rs +++ b/src/session/model/verification/verification_list.rs @@ -1,5 +1,4 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::{debug, warn}; use matrix_sdk::ruma::{ events::{ room::message::MessageType, AnySyncMessageLikeEvent, AnySyncTimelineEvent, @@ -9,6 +8,7 @@ use matrix_sdk::ruma::{ MilliSecondsSinceUnixEpoch, OwnedUserId, UserId, }; use ruma::events::key::verification::REQUEST_TIMESTAMP_TIMEOUT; +use tracing::{debug, warn}; use crate::{ prelude::*, diff --git a/src/session/view/account_settings/devices_page/device_list.rs b/src/session/view/account_settings/devices_page/device_list.rs index 38f5ad90..e8ac78c3 100644 --- a/src/session/view/account_settings/devices_page/device_list.rs +++ b/src/session/view/account_settings/devices_page/device_list.rs @@ -1,10 +1,10 @@ use gettextrs::gettext; use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::error; use matrix_sdk::{ encryption::identities::UserDevices as CryptoDevices, ruma::api::client::device::Device as MatrixDevice, Error, }; +use tracing::error; use super::{Device, DeviceItem}; use crate::{session::model::Session, spawn, spawn_tokio}; diff --git a/src/session/view/account_settings/devices_page/device_row.rs b/src/session/view/account_settings/devices_page/device_row.rs index 963693cc..41029da9 100644 --- a/src/session/view/account_settings/devices_page/device_row.rs +++ b/src/session/view/account_settings/devices_page/device_row.rs @@ -1,7 +1,7 @@ use adw::{self, prelude::*}; use gettextrs::gettext; use gtk::{glib, glib::clone, subclass::prelude::*, CompositeTemplate}; -use log::error; +use tracing::error; use super::Device; use crate::{ diff --git a/src/session/view/account_settings/notifications_page.rs b/src/session/view/account_settings/notifications_page.rs index 45a4c295..c311f577 100644 --- a/src/session/view/account_settings/notifications_page.rs +++ b/src/session/view/account_settings/notifications_page.rs @@ -1,13 +1,13 @@ use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use gtk::{glib, glib::clone, CompositeTemplate}; -use log::{error, warn}; use matrix_sdk::event_handler::EventHandlerDropGuard; use ruma::{ api::client::push::{set_pushrule_enabled, RuleKind, RuleScope}, events::push_rules::{PushRulesEvent, PushRulesEventContent}, push::{PredefinedOverrideRuleId, Ruleset}, }; +use tracing::{error, warn}; use crate::{prelude::*, session::model::Session, spawn, spawn_tokio, toast}; diff --git a/src/session/view/account_settings/security_page/import_export_keys_subpage.rs b/src/session/view/account_settings/security_page/import_export_keys_subpage.rs index 0bfcfd27..8b0e97ae 100644 --- a/src/session/view/account_settings/security_page/import_export_keys_subpage.rs +++ b/src/session/view/account_settings/security_page/import_export_keys_subpage.rs @@ -5,8 +5,8 @@ use gtk::{ glib::{self, clone}, CompositeTemplate, }; -use log::{debug, error}; use matrix_sdk::encryption::{KeyExportError, RoomKeyImportError}; +use tracing::{debug, error}; use crate::{ components::SpinnerButton, ngettext_f, session::model::Session, spawn, spawn_tokio, toast, diff --git a/src/session/view/account_settings/user_page/change_password_subpage.rs b/src/session/view/account_settings/user_page/change_password_subpage.rs index 9ca14341..6423aee3 100644 --- a/src/session/view/account_settings/user_page/change_password_subpage.rs +++ b/src/session/view/account_settings/user_page/change_password_subpage.rs @@ -4,11 +4,11 @@ use gtk::{ glib::{self, clone}, CompositeTemplate, }; -use log::error; use matrix_sdk::ruma::{ api::client::{account::change_password, error::ErrorKind}, assign, }; +use tracing::error; use crate::{ components::{AuthDialog, AuthError, SpinnerButton}, diff --git a/src/session/view/account_settings/user_page/deactivate_account_subpage.rs b/src/session/view/account_settings/user_page/deactivate_account_subpage.rs index 27a0eaa5..8c246342 100644 --- a/src/session/view/account_settings/user_page/deactivate_account_subpage.rs +++ b/src/session/view/account_settings/user_page/deactivate_account_subpage.rs @@ -4,8 +4,8 @@ use gtk::{ glib::{self, clone}, CompositeTemplate, }; -use log::error; use matrix_sdk::ruma::{api::client::account::deactivate, assign}; +use tracing::error; use crate::{ components::{AuthDialog, SpinnerButton}, diff --git a/src/session/view/account_settings/user_page/mod.rs b/src/session/view/account_settings/user_page/mod.rs index bb89ad00..4b3d2046 100644 --- a/src/session/view/account_settings/user_page/mod.rs +++ b/src/session/view/account_settings/user_page/mod.rs @@ -5,8 +5,8 @@ use gtk::{ glib::{self, clone}, CompositeTemplate, }; -use log::error; use matrix_sdk::ruma::{api::client::discovery::get_capabilities, OwnedMxcUri}; +use tracing::error; mod change_password_subpage; mod deactivate_account_subpage; diff --git a/src/session/view/content/explore/public_room_list.rs b/src/session/view/content/explore/public_room_list.rs index 51408f0b..73b92ebc 100644 --- a/src/session/view/content/explore/public_room_list.rs +++ b/src/session/view/content/explore/public_room_list.rs @@ -1,5 +1,4 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::error; use matrix_sdk::ruma::{ api::client::directory::get_public_rooms_filtered::v3::{ Request as PublicRoomsRequest, Response as PublicRoomsResponse, @@ -9,6 +8,7 @@ use matrix_sdk::ruma::{ uint, ServerName, }; use ruma::directory::RoomTypeFilter; +use tracing::error; use super::{PublicRoom, Server}; use crate::{session::model::Session, spawn, spawn_tokio}; diff --git a/src/session/view/content/explore/server_list.rs b/src/session/view/content/explore/server_list.rs index e0c34164..f969287c 100644 --- a/src/session/view/content/explore/server_list.rs +++ b/src/session/view/content/explore/server_list.rs @@ -1,6 +1,6 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::error; use ruma::api::client::thirdparty::get_protocols; +use tracing::error; use super::Server; use crate::{prelude::*, session::model::Session, spawn, spawn_tokio}; diff --git a/src/session/view/content/room_details/general_page/mod.rs b/src/session/view/content/room_details/general_page/mod.rs index 5d837aac..af8b6857 100644 --- a/src/session/view/content/room_details/general_page/mod.rs +++ b/src/session/view/content/room_details/general_page/mod.rs @@ -7,7 +7,6 @@ use gtk::{ glib::{self, clone}, CompositeTemplate, }; -use log::error; use matrix_sdk::RoomState; use ruma::{ assign, @@ -17,6 +16,7 @@ use ruma::{ }, OwnedMxcUri, }; +use tracing::error; use crate::{ components::{CustomEntry, EditableAvatar, SpinnerButton}, diff --git a/src/session/view/content/room_details/history_viewer/audio_row.rs b/src/session/view/content/room_details/history_viewer/audio_row.rs index 3d0f2234..74238d9c 100644 --- a/src/session/view/content/room_details/history_viewer/audio_row.rs +++ b/src/session/view/content/room_details/history_viewer/audio_row.rs @@ -2,11 +2,11 @@ use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use glib::clone; use gtk::{gio, glib, CompositeTemplate}; -use log::warn; use matrix_sdk::ruma::events::{ room::message::{AudioMessageEventContent, MessageType}, AnyMessageLikeEventContent, }; +use tracing::warn; use super::HistoryViewerEvent; use crate::{session::model::Session, spawn, spawn_tokio}; diff --git a/src/session/view/content/room_details/history_viewer/file_row.rs b/src/session/view/content/room_details/history_viewer/file_row.rs index 3cdc88c9..ebd1423c 100644 --- a/src/session/view/content/room_details/history_viewer/file_row.rs +++ b/src/session/view/content/room_details/history_viewer/file_row.rs @@ -1,8 +1,8 @@ use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use gtk::{gio, glib, CompositeTemplate}; -use log::error; use matrix_sdk::ruma::events::{room::message::MessageType, AnyMessageLikeEventContent}; +use tracing::error; use super::HistoryViewerEvent; use crate::{prelude::*, toast}; @@ -135,7 +135,7 @@ impl FileRow { if let Err(e) = gio::AppInfo::launch_default_for_uri(&file.uri(), gio::AppLaunchContext::NONE) { - log::error!("Error: {e}"); + error!("Error: {e}"); } } } diff --git a/src/session/view/content/room_details/history_viewer/media.rs b/src/session/view/content/room_details/history_viewer/media.rs index 3dcafae5..5393ee3d 100644 --- a/src/session/view/content/room_details/history_viewer/media.rs +++ b/src/session/view/content/room_details/history_viewer/media.rs @@ -1,7 +1,7 @@ use adw::{prelude::*, subclass::prelude::*}; use gtk::{glib, glib::clone, CompositeTemplate}; -use log::error; use ruma::events::AnyMessageLikeEventContent; +use tracing::error; use super::{MediaItem, Timeline, TimelineFilter}; use crate::{ diff --git a/src/session/view/content/room_details/history_viewer/media_item.rs b/src/session/view/content/room_details/history_viewer/media_item.rs index 89dd9b34..1a04b8dd 100644 --- a/src/session/view/content/room_details/history_viewer/media_item.rs +++ b/src/session/view/content/room_details/history_viewer/media_item.rs @@ -1,5 +1,4 @@ use gtk::{gdk, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate}; -use log::warn; use matrix_sdk::{ media::{MediaEventContent, MediaThumbnailSize}, ruma::{ @@ -11,6 +10,7 @@ use matrix_sdk::{ uint, }, }; +use tracing::warn; use super::{HistoryViewerEvent, MediaHistoryViewer}; use crate::{session::model::Session, spawn, spawn_tokio}; diff --git a/src/session/view/content/room_details/history_viewer/timeline.rs b/src/session/view/content/room_details/history_viewer/timeline.rs index c4a40bdf..30b896f4 100644 --- a/src/session/view/content/room_details/history_viewer/timeline.rs +++ b/src/session/view/content/room_details/history_viewer/timeline.rs @@ -1,5 +1,4 @@ use gtk::{gio, glib, prelude::*, subclass::prelude::*}; -use log::error; use matrix_sdk::{ room::MessagesOptions, ruma::{ @@ -9,6 +8,7 @@ use matrix_sdk::{ uint, }, }; +use tracing::error; use super::HistoryViewerEvent; use crate::{ diff --git a/src/session/view/content/room_details/invite_subpage/invitee_list.rs b/src/session/view/content/room_details/invite_subpage/invitee_list.rs index 433d0d82..5b6d8075 100644 --- a/src/session/view/content/room_details/invite_subpage/invitee_list.rs +++ b/src/session/view/content/room_details/invite_subpage/invitee_list.rs @@ -1,6 +1,5 @@ use gettextrs::gettext; use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::error; use matrix_sdk::{ ruma::{ api::client::{profile::get_profile, user_directory::search_users}, @@ -8,6 +7,7 @@ use matrix_sdk::{ }, HttpError, }; +use tracing::error; use super::Invitee; use crate::{ diff --git a/src/session/view/content/room_details/member_page/mod.rs b/src/session/view/content/room_details/member_page/mod.rs index 721da356..90e9dc5f 100644 --- a/src/session/view/content/room_details/member_page/mod.rs +++ b/src/session/view/content/room_details/member_page/mod.rs @@ -8,7 +8,7 @@ use gtk::{ glib::{self, clone, closure}, CompositeTemplate, }; -use log::warn; +use tracing::warn; mod member_menu; mod members_list_view; diff --git a/src/session/view/content/room_details/mod.rs b/src/session/view/content/room_details/mod.rs index 93306f6e..25bae0a7 100644 --- a/src/session/view/content/room_details/mod.rs +++ b/src/session/view/content/room_details/mod.rs @@ -8,7 +8,7 @@ use std::convert::From; use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use gtk::{glib, CompositeTemplate}; -use log::warn; +use tracing::warn; pub use self::{ general_page::GeneralPage, diff --git a/src/session/view/content/room_history/event_actions.rs b/src/session/view/content/room_history/event_actions.rs index 53b5ad04..5bbc6a12 100644 --- a/src/session/view/content/room_history/event_actions.rs +++ b/src/session/view/content/room_history/event_actions.rs @@ -1,9 +1,9 @@ use gettextrs::gettext; use gtk::{gdk, gio, glib, glib::clone, prelude::*}; -use log::error; use matrix_sdk_ui::timeline::TimelineItemContent; use once_cell::sync::Lazy; use ruma::events::room::{message::MessageType, power_levels::PowerLevelAction}; +use tracing::error; use crate::{ prelude::*, diff --git a/src/session/view/content/room_history/message_row/audio.rs b/src/session/view/content/room_history/message_row/audio.rs index ae799799..38c9c86e 100644 --- a/src/session/view/content/room_history/message_row/audio.rs +++ b/src/session/view/content/room_history/message_row/audio.rs @@ -5,8 +5,8 @@ use gtk::{ glib::{self, clone}, CompositeTemplate, }; -use log::warn; use matrix_sdk::ruma::events::room::message::AudioMessageEventContent; +use tracing::warn; use super::{media::MediaState, ContentFormat}; use crate::{ diff --git a/src/session/view/content/room_history/message_row/content.rs b/src/session/view/content/room_history/message_row/content.rs index 8cd2dc09..e9767378 100644 --- a/src/session/view/content/room_history/message_row/content.rs +++ b/src/session/view/content/room_history/message_row/content.rs @@ -1,9 +1,9 @@ use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use gtk::{gdk, glib, glib::clone}; -use log::{error, warn}; use matrix_sdk_ui::timeline::{TimelineDetails, TimelineItemContent}; use ruma::events::room::message::MessageType; +use tracing::{error, warn}; use super::{ audio::MessageAudio, file::MessageFile, location::MessageLocation, media::MessageMedia, diff --git a/src/session/view/content/room_history/message_row/location.rs b/src/session/view/content/room_history/message_row/location.rs index 0a53c731..d5b4c856 100644 --- a/src/session/view/content/room_history/message_row/location.rs +++ b/src/session/view/content/room_history/message_row/location.rs @@ -2,7 +2,7 @@ use adw::{prelude::*, subclass::prelude::*}; use geo_uri::GeoUri; use gettextrs::gettext; use gtk::{glib, CompositeTemplate}; -use log::warn; +use tracing::warn; use super::ContentFormat; use crate::components::LocationViewer; diff --git a/src/session/view/content/room_history/message_row/media.rs b/src/session/view/content/room_history/message_row/media.rs index f763557e..ef07cee4 100644 --- a/src/session/view/content/room_history/message_row/media.rs +++ b/src/session/view/content/room_history/message_row/media.rs @@ -5,7 +5,6 @@ use gtk::{ glib::{self, clone}, CompositeTemplate, }; -use log::warn; use matrix_sdk::{ media::{MediaEventContent, MediaThumbnailSize}, ruma::{ @@ -16,6 +15,7 @@ use matrix_sdk::{ }, }, }; +use tracing::warn; use super::ContentFormat; use crate::{ diff --git a/src/session/view/content/room_history/mod.rs b/src/session/view/content/room_history/mod.rs index df97730a..60b86c2b 100644 --- a/src/session/view/content/room_history/mod.rs +++ b/src/session/view/content/room_history/mod.rs @@ -25,7 +25,6 @@ use gtk::{ prelude::*, CompositeTemplate, }; -use log::{debug, error, warn}; use matrix_sdk::{ attachment::{AttachmentInfo, BaseFileInfo, BaseImageInfo}, ruma::{ @@ -49,6 +48,7 @@ use ruma::{ OwnedEventId, }; use sourceview::prelude::*; +use tracing::{debug, error, warn}; use self::{ attachment_dialog::AttachmentDialog, diff --git a/src/session/view/content/room_history/state_row/mod.rs b/src/session/view/content/room_history/state_row/mod.rs index ead4e441..b7a73d76 100644 --- a/src/session/view/content/room_history/state_row/mod.rs +++ b/src/session/view/content/room_history/state_row/mod.rs @@ -4,7 +4,6 @@ mod tombstone; use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use gtk::{glib, CompositeTemplate}; -use log::warn; use matrix_sdk_ui::timeline::{ AnyOtherFullStateEventContent, MemberProfileChange, MembershipChange, OtherState, RoomMembershipChange, TimelineItemContent, @@ -13,6 +12,7 @@ use ruma::{ events::{room::member::MembershipState, FullStateEventContent}, UserId, }; +use tracing::warn; use self::{creation::StateCreation, tombstone::StateTombstone}; use super::ReadReceiptsList; diff --git a/src/session/view/content/verification/identity_verification_widget.rs b/src/session/view/content/verification/identity_verification_widget.rs index 20bf2055..b83b7440 100644 --- a/src/session/view/content/verification/identity_verification_widget.rs +++ b/src/session/view/content/verification/identity_verification_widget.rs @@ -3,9 +3,9 @@ use std::collections::HashMap; use adw::subclass::prelude::*; use gettextrs::gettext; use gtk::{gio, glib, glib::clone, prelude::*, CompositeTemplate}; -use log::{error, warn}; use matrix_sdk::encryption::verification::QrVerificationData; use ruma::events::key::verification::cancel::CancelCode; +use tracing::{error, warn}; use super::Emoji; use crate::{ diff --git a/src/session/view/content/verification/session_verification.rs b/src/session/view/content/verification/session_verification.rs index 4ea16e66..47faf638 100644 --- a/src/session/view/content/verification/session_verification.rs +++ b/src/session/view/content/verification/session_verification.rs @@ -1,7 +1,7 @@ use adw::subclass::prelude::*; use gettextrs::gettext; use gtk::{glib, glib::clone, prelude::*, CompositeTemplate}; -use log::{debug, error}; +use tracing::{debug, error}; use super::IdentityVerificationWidget; use crate::{ diff --git a/src/session/view/create_dm_dialog/dm_user.rs b/src/session/view/create_dm_dialog/dm_user.rs index b47d272e..34333611 100644 --- a/src/session/view/create_dm_dialog/dm_user.rs +++ b/src/session/view/create_dm_dialog/dm_user.rs @@ -1,11 +1,11 @@ use gtk::{glib, prelude::*, subclass::prelude::*}; -use log::{debug, error}; use matrix_sdk::ruma::{ api::client::room::create_room, assign, events::{room::encryption::RoomEncryptionEventContent, InitialStateEvent}, MxcUri, UserId, }; +use tracing::{debug, error}; use crate::{ prelude::*, diff --git a/src/session/view/create_dm_dialog/dm_user_list.rs b/src/session/view/create_dm_dialog/dm_user_list.rs index 7fff4046..1cf07687 100644 --- a/src/session/view/create_dm_dialog/dm_user_list.rs +++ b/src/session/view/create_dm_dialog/dm_user_list.rs @@ -1,6 +1,6 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::{debug, error}; use matrix_sdk::ruma::{api::client::user_directory::search_users, OwnedUserId, UserId}; +use tracing::{debug, error}; use super::DmUser; use crate::{ diff --git a/src/session/view/media_viewer.rs b/src/session/view/media_viewer.rs index fd123a3b..205a3b06 100644 --- a/src/session/view/media_viewer.rs +++ b/src/session/view/media_viewer.rs @@ -1,9 +1,9 @@ use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use gtk::{gdk, gio, glib, glib::clone, graphene, CompositeTemplate}; -use log::{error, warn}; use matrix_sdk::ruma::events::room::message::MessageType; use ruma::OwnedEventId; +use tracing::{error, warn}; use crate::{ components::{ContentType, ImagePaintable, MediaContentViewer, ScaleRevealer}, diff --git a/src/session/view/room_creation.rs b/src/session/view/room_creation.rs index 2f720707..f5820be7 100644 --- a/src/session/view/room_creation.rs +++ b/src/session/view/room_creation.rs @@ -1,7 +1,6 @@ use adw::{prelude::*, subclass::prelude::*}; use gettextrs::gettext; use gtk::{gdk, glib, glib::clone, CompositeTemplate}; -use log::error; use matrix_sdk::{ ruma::{ api::client::{ @@ -13,6 +12,7 @@ use matrix_sdk::{ Error, }; use ruma::events::{room::encryption::RoomEncryptionEventContent, InitialStateEvent}; +use tracing::error; use crate::{ components::SpinnerButton, prelude::*, session::model::Session, spawn, spawn_tokio, Window, diff --git a/src/session/view/session_view.rs b/src/session/view/session_view.rs index 1026ddcb..25d1e23e 100644 --- a/src/session/view/session_view.rs +++ b/src/session/view/session_view.rs @@ -4,8 +4,8 @@ use gtk::{ glib::{clone, signal::SignalHandlerId}, CompositeTemplate, }; -use log::{error, warn}; use ruma::RoomId; +use tracing::{error, warn}; use super::{Content, CreateDmDialog, JoinRoomDialog, MediaViewer, RoomCreation, Sidebar}; use crate::{ diff --git a/src/session/view/sidebar/mod.rs b/src/session/view/sidebar/mod.rs index f603531f..937b5f4e 100644 --- a/src/session/view/sidebar/mod.rs +++ b/src/session/view/sidebar/mod.rs @@ -6,7 +6,7 @@ mod verification_row; use adw::{prelude::*, subclass::prelude::*}; use gtk::{gio, glib, glib::clone, CompositeTemplate}; -use log::error; +use tracing::error; use self::{ category_row::CategoryRow, entry_row::EntryRow, room_row::RoomRow, row::Row, diff --git a/src/utils/expression_list_model.rs b/src/utils/expression_list_model.rs index 25a67224..ff8ecb3d 100644 --- a/src/utils/expression_list_model.rs +++ b/src/utils/expression_list_model.rs @@ -1,5 +1,5 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*}; -use log::error; +use tracing::error; use crate::utils::BoundObject; diff --git a/src/utils/media.rs b/src/utils/media.rs index ec45231d..ea07f89c 100644 --- a/src/utils/media.rs +++ b/src/utils/media.rs @@ -4,9 +4,9 @@ use std::{cell::Cell, str::FromStr, sync::Mutex}; use gettextrs::gettext; use gtk::{gio, glib, prelude::*}; -use log::{debug, error}; use matrix_sdk::attachment::{BaseAudioInfo, BaseImageInfo, BaseVideoInfo}; use mime::Mime; +use tracing::{debug, error}; use crate::toast; diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 0e63ed0a..f357b675 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -24,6 +24,7 @@ use gtk::{ use matrix_sdk::ruma::UInt; use once_cell::sync::{Lazy, OnceCell}; use regex::Regex; +use tracing::error; pub use self::expression_list_model::ExpressionListModel; use crate::RUNTIME; @@ -117,7 +118,7 @@ pub async fn check_if_reachable(hostname: &impl AsRef) -> bool { match monitor.can_reach_future(&address).await { Ok(()) => true, Err(error) => { - log::error!("Homeserver {} isn't reachable: {error}", hostname.as_ref()); + error!("Homeserver {} isn't reachable: {error}", hostname.as_ref()); false } } diff --git a/src/window.rs b/src/window.rs index c9adf762..f524b59e 100644 --- a/src/window.rs +++ b/src/window.rs @@ -4,8 +4,8 @@ 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::{error, info, warn}; use ruma::RoomId; +use tracing::{error, info, warn}; use crate::{ account_switcher::AccountSwitcher,