diff --git a/Cargo.lock b/Cargo.lock index eff9ffba..b3ac5120 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3281,7 +3281,6 @@ dependencies = [ "hex", "humantime", "itertools", - "log", "opendal", "rand", "rayon", @@ -3295,6 +3294,7 @@ dependencies = [ "thiserror", "tokio", "toml", + "tracing", "typed-path", "url", "walkdir", @@ -3341,7 +3341,6 @@ dependencies = [ "insta", "integer-sqrt", "itertools", - "log", "mockall", "nix", "pariter", @@ -3372,6 +3371,7 @@ dependencies = [ "tempfile", "thiserror", "toml", + "tracing", "walkdir", "xattr", "zstd", @@ -4201,6 +4201,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", diff --git a/Cargo.toml b/Cargo.toml index e54d61d6..ac31e778 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,11 +15,15 @@ rust-version = "1.76.0" aho-corasick = "1.1.3" anyhow = "1.0.89" bytes = "1.7.2" +derive_setters = "0.1.6" +displaydoc = "0.2.5" enum-map = "2.7.3" rustic_backend = { path = "crates/backend" } rustic_core = { path = "crates/core", version = "0" } rustic_testing = { path = "crates/testing", version = "0" } simplelog = "0.12.2" +thiserror = "1.0.64" +tracing = { version = "0.1.40", features = ["log"] } # dev-dependencies rstest = "0.23.0" diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 5c579d6f..28d21098 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -50,16 +50,16 @@ rclone = ["rest", "dep:rand", "dep:semver"] rustic_core = { workspace = true } # errors -anyhow = "1.0.89" -displaydoc = "0.2.5" -thiserror = "1.0.64" +anyhow = { workspace = true } +displaydoc = { workspace = true } +thiserror = { workspace = true } # logging -log = "0.4.22" +tracing = { workspace = true } # other dependencies -bytes = "1.7.2" -derive_setters = "0.1.6" +bytes = { workspace = true } +derive_setters = { workspace = true } humantime = "2.1.0" itertools = "0.13.0" strum = "0.26" diff --git a/crates/backend/src/local.rs b/crates/backend/src/local.rs index df52ade5..adc9432f 100644 --- a/crates/backend/src/local.rs +++ b/crates/backend/src/local.rs @@ -8,7 +8,7 @@ use std::{ use aho_corasick::AhoCorasick; use anyhow::Result; use bytes::Bytes; -use log::{debug, trace, warn}; +use tracing::{debug, trace, warn}; use walkdir::WalkDir; use rustic_core::{CommandInput, FileType, Id, ReadBackend, WriteBackend, ALL_FILE_TYPES}; diff --git a/crates/backend/src/opendal.rs b/crates/backend/src/opendal.rs index 275b9429..a948218d 100644 --- a/crates/backend/src/opendal.rs +++ b/crates/backend/src/opendal.rs @@ -4,13 +4,13 @@ use std::{collections::HashMap, str::FromStr, sync::OnceLock}; use anyhow::{anyhow, Error, Result}; use bytes::Bytes; use bytesize::ByteSize; -use log::trace; use opendal::{ layers::{BlockingLayer, ConcurrentLimitLayer, LoggingLayer, RetryLayer, ThrottleLayer}, BlockingOperator, ErrorKind, Metakey, Operator, Scheme, }; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; use tokio::runtime::Runtime; +use tracing::trace; use typed_path::UnixPathBuf; use rustic_core::{FileType, Id, ReadBackend, WriteBackend, ALL_FILE_TYPES}; @@ -235,6 +235,7 @@ impl ReadBackend for OpenDALBackend { impl WriteBackend for OpenDALBackend { /// Create a repository on the backend. + #[tracing::instrument(skip(self))] fn create(&self) -> Result<()> { trace!("creating repo at {:?}", self.location()); diff --git a/crates/backend/src/rclone.rs b/crates/backend/src/rclone.rs index 84e72a86..46d854d8 100644 --- a/crates/backend/src/rclone.rs +++ b/crates/backend/src/rclone.rs @@ -8,12 +8,12 @@ use std::{ use anyhow::Result; use bytes::Bytes; use constants::DEFAULT_COMMAND; -use log::{debug, info}; use rand::{ distributions::{Alphanumeric, DistString}, thread_rng, }; use semver::{BuildMetadata, Prerelease, Version, VersionReq}; +use tracing::{debug, info}; use crate::{error::RcloneErrorKind, rest::RestBackend}; @@ -127,6 +127,7 @@ impl RcloneBackend { /// /// If the rclone command is not found. // TODO: This should be an error, not a panic. + #[tracing::instrument(skip(url))] pub fn new(url: impl AsRef, options: HashMap) -> Result { let rclone_command = options.get("rclone-command"); let use_password = options diff --git a/crates/backend/src/rest.rs b/crates/backend/src/rest.rs index 3b0b5683..3acf8656 100644 --- a/crates/backend/src/rest.rs +++ b/crates/backend/src/rest.rs @@ -4,13 +4,13 @@ use std::time::Duration; use anyhow::Result; use backoff::{backoff::Backoff, ExponentialBackoff, ExponentialBackoffBuilder}; use bytes::Bytes; -use log::{trace, warn}; use reqwest::{ blocking::{Client, ClientBuilder, Response}, header::{HeaderMap, HeaderValue}, Url, }; use serde::Deserialize; +use tracing::{trace, warn}; use crate::error::RestErrorKind; @@ -245,6 +245,7 @@ impl ReadBackend for RestBackend { /// A vector of tuples containing the id and size of the files. /// /// [`RestErrorKind::JoiningUrlFailed`]: RestErrorKind::JoiningUrlFailed + #[tracing::instrument(skip(self))] fn list_with_size(&self, tpe: FileType) -> Result> { // format which is delivered by the REST-service #[derive(Deserialize)] @@ -313,6 +314,7 @@ impl ReadBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self))] fn read_full(&self, tpe: FileType, id: &Id) -> Result { trace!("reading tpe: {tpe:?}, id: {id}"); let url = self.url(tpe, id)?; @@ -346,6 +348,7 @@ impl ReadBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self, _cacheable))] fn read_partial( &self, tpe: FileType, @@ -383,6 +386,7 @@ impl WriteBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self))] fn create(&self) -> Result<()> { let url = self .url @@ -413,6 +417,7 @@ impl WriteBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self, _cacheable))] fn write_bytes(&self, tpe: FileType, id: &Id, _cacheable: bool, buf: Bytes) -> Result<()> { trace!("writing tpe: {:?}, id: {}", &tpe, &id); let req_builder = self.client.post(self.url(tpe, id)?).body(buf); @@ -441,6 +446,7 @@ impl WriteBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self, _cacheable))] fn remove(&self, tpe: FileType, id: &Id, _cacheable: bool) -> Result<()> { trace!("removing tpe: {:?}, id: {}", &tpe, &id); let url = self.url(tpe, id)?; diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index e83c7330..50ae87e9 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -41,16 +41,16 @@ rustdoc-args = ["--document-private-items", "--generate-link-to-definition"] [dependencies] # errors -displaydoc = "0.2.5" -thiserror = "1.0.64" +displaydoc = { workspace = true } +thiserror = { workspace = true } # macros derivative = "2.2.0" derive_more = { version = "1.0.0", features = ["add", "constructor", "display", "from", "deref", "from_str"] } -derive_setters = "0.1.6" +derive_setters = { workspace = true } # logging -log = "0.4.22" +tracing = { workspace = true } # parallelize crossbeam-channel = "0.5.13" diff --git a/crates/core/src/archiver.rs b/crates/core/src/archiver.rs index 9a304a7b..0254b13d 100644 --- a/crates/core/src/archiver.rs +++ b/crates/core/src/archiver.rs @@ -6,8 +6,8 @@ pub(crate) mod tree_archiver; use std::path::{Path, PathBuf}; use chrono::Local; -use log::warn; use pariter::{scope, IteratorExt}; +use tracing::warn; use crate::{ archiver::{ @@ -121,6 +121,7 @@ impl<'a, BE: DecryptFullBackend, I: ReadGlobalIndex> Archiver<'a, BE, I> { /// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed /// [`CryptBackendErrorKind::SerializingToJsonByteVectorFailed`]: crate::error::CryptBackendErrorKind::SerializingToJsonByteVectorFailed /// [`SnapshotFileErrorKind::OutOfRange`]: crate::error::SnapshotFileErrorKind::OutOfRange + #[tracing::instrument(skip(self, src, p))] pub fn archive( mut self, src: &R, diff --git a/crates/core/src/archiver/parent.rs b/crates/core/src/archiver/parent.rs index 6db8917f..d1374c7b 100644 --- a/crates/core/src/archiver/parent.rs +++ b/crates/core/src/archiver/parent.rs @@ -3,7 +3,7 @@ use std::{ ffi::{OsStr, OsString}, }; -use log::warn; +use tracing::warn; use crate::{ archiver::tree::TreeType, diff --git a/crates/core/src/archiver/tree_archiver.rs b/crates/core/src/archiver/tree_archiver.rs index 3e2cc319..d772dae2 100644 --- a/crates/core/src/archiver/tree_archiver.rs +++ b/crates/core/src/archiver/tree_archiver.rs @@ -1,7 +1,7 @@ use std::path::{Path, PathBuf}; use bytesize::ByteSize; -use log::{debug, trace}; +use tracing::{debug, trace}; use crate::{ archiver::{parent::ParentResult, tree::TreeType}, diff --git a/crates/core/src/backend.rs b/crates/core/src/backend.rs index b232ceb1..846ae16c 100644 --- a/crates/core/src/backend.rs +++ b/crates/core/src/backend.rs @@ -15,7 +15,7 @@ use std::{io::Read, ops::Deref, path::PathBuf, sync::Arc}; use anyhow::Result; use bytes::Bytes; use enum_map::Enum; -use log::trace; +use tracing::trace; #[cfg(test)] use mockall::mock; diff --git a/crates/core/src/backend/cache.rs b/crates/core/src/backend/cache.rs index d00d9699..89607018 100644 --- a/crates/core/src/backend/cache.rs +++ b/crates/core/src/backend/cache.rs @@ -9,7 +9,7 @@ use std::{ use anyhow::Result; use bytes::Bytes; use dirs::cache_dir; -use log::{trace, warn}; +use tracing::{trace, warn}; use walkdir::WalkDir; use crate::{ diff --git a/crates/core/src/backend/decrypt.rs b/crates/core/src/backend/decrypt.rs index e90d6f86..20705047 100644 --- a/crates/core/src/backend/decrypt.rs +++ b/crates/core/src/backend/decrypt.rs @@ -161,6 +161,7 @@ pub trait DecryptReadBackend: ReadBackend + Clone + 'static { /// # Errors /// /// If the files could not be read. + #[tracing::instrument(skip(self, p))] fn stream_list(&self, list: &[Id], p: &impl Progress) -> StreamResult { p.set_length(list.len() as u64); let (tx, rx) = unbounded(); @@ -279,6 +280,7 @@ pub trait DecryptWriteBackend: WriteBackend + Clone + 'static { /// # Errors /// /// * [`CryptBackendErrorKind::SerializingToJsonByteVectorFailed`] - If the file could not be serialized to json. + #[tracing::instrument(skip(self, list, p))] fn save_list<'a, F: RepoFile, I: ExactSizeIterator + Send>( &self, list: I, @@ -306,6 +308,7 @@ pub trait DecryptWriteBackend: WriteBackend + Clone + 'static { /// # Panics /// /// If the files could not be deleted. + #[tracing::instrument(skip(self, list, p))] fn delete_list<'a, ID: RepoId, I: ExactSizeIterator + Send>( &self, cacheable: bool, diff --git a/crates/core/src/backend/ignore.rs b/crates/core/src/backend/ignore.rs index 4270851f..6d9f14c1 100644 --- a/crates/core/src/backend/ignore.rs +++ b/crates/core/src/backend/ignore.rs @@ -16,9 +16,9 @@ use chrono::TimeZone; use chrono::{DateTime, Local, Utc}; use derive_setters::Setters; use ignore::{overrides::OverrideBuilder, DirEntry, Walk, WalkBuilder}; -use log::warn; #[cfg(not(windows))] use nix::unistd::{Gid, Group, Uid, User}; +use tracing::warn; #[cfg(not(windows))] use crate::backend::node::ExtendedAttribute; diff --git a/crates/core/src/backend/local_destination.rs b/crates/core/src/backend/local_destination.rs index 8c2ea2d4..eb136135 100644 --- a/crates/core/src/backend/local_destination.rs +++ b/crates/core/src/backend/local_destination.rs @@ -12,14 +12,14 @@ use bytes::Bytes; use cached::proc_macro::cached; use filetime::{set_symlink_file_times, FileTime}; #[cfg(not(windows))] -use log::warn; -#[cfg(not(windows))] use nix::sys::stat::{mknod, Mode, SFlag}; #[cfg(not(windows))] use nix::{ fcntl::AtFlags, unistd::{fchownat, Gid, Group, Uid, User}, }; +#[cfg(not(windows))] +use tracing::warn; #[cfg(not(windows))] use crate::backend::ignore::mapper::map_mode_from_go; diff --git a/crates/core/src/blob/packer.rs b/crates/core/src/blob/packer.rs index 62c82759..1ccd2664 100644 --- a/crates/core/src/blob/packer.rs +++ b/crates/core/src/blob/packer.rs @@ -1,5 +1,5 @@ use integer_sqrt::IntegerSquareRoot; -use log::warn; +use tracing::warn; use std::{ num::NonZeroU32, @@ -194,6 +194,7 @@ impl Packer { /// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed /// [`PackerErrorKind::IntConversionFailed`]: crate::error::PackerErrorKind::IntConversionFailed #[allow(clippy::unnecessary_wraps)] + #[tracing::instrument(skip(be, indexer))] pub fn new( be: BE, blob_type: BlobType, @@ -295,6 +296,7 @@ impl Packer { /// * [`PackerErrorKind::SendingCrossbeamMessageFailed`] - If sending the message to the raw packer fails. /// /// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed + #[tracing::instrument(skip(self))] fn add_with_sizelimit( &self, data: Bytes, @@ -602,6 +604,7 @@ impl RawPacker { /// /// [`PackerErrorKind::IntConversionFailed`]: crate::error::PackerErrorKind::IntConversionFailed /// [`PackFileErrorKind::WritingBinaryRepresentationFailed`]: crate::error::PackFileErrorKind::WritingBinaryRepresentationFailed + #[tracing::instrument(skip(self))] fn save(&mut self) -> RusticResult<()> { if self.size == 0 { return Ok(()); @@ -677,6 +680,7 @@ impl Actor { /// * `fwh` - The file writer handle. /// * `queue_len` - The length of the queue. /// * `par` - The number of parallel threads. + #[tracing::instrument(skip(fwh, _par))] fn new( fwh: FileWriterHandle, queue_len: usize, @@ -718,6 +722,7 @@ impl Actor { /// # Errors /// /// If sending the message to the actor fails. + #[tracing::instrument(skip(self))] fn send(&self, load: (Bytes, IndexPack)) -> RusticResult<()> { self.sender .send(load) diff --git a/crates/core/src/blob/tree.rs b/crates/core/src/blob/tree.rs index ffd03577..1e7847cc 100644 --- a/crates/core/src/blob/tree.rs +++ b/crates/core/src/blob/tree.rs @@ -671,6 +671,7 @@ impl TreeStreamerOnce

{ /// * [`TreeErrorKind::SendingCrossbeamMessageFailed`] - If sending the message fails. /// /// [`TreeErrorKind::SendingCrossbeamMessageFailed`]: crate::error::TreeErrorKind::SendingCrossbeamMessageFailed + #[tracing::instrument(skip(be, index, p))] pub fn new( be: &BE, index: &I, @@ -733,6 +734,7 @@ impl TreeStreamerOnce

{ /// * [`TreeErrorKind::SendingCrossbeamMessageFailed`] - If sending the message fails. /// /// [`TreeErrorKind::SendingCrossbeamMessageFailed`]: crate::error::TreeErrorKind::SendingCrossbeamMessageFailed + #[tracing::instrument(skip(self))] fn add_pending(&mut self, path: PathBuf, id: TreeId, count: usize) -> RusticResult { if self.visited.insert(id) { self.queue_in diff --git a/crates/core/src/commands/backup.rs b/crates/core/src/commands/backup.rs index 1d6b60d0..1d7b92fb 100644 --- a/crates/core/src/commands/backup.rs +++ b/crates/core/src/commands/backup.rs @@ -1,6 +1,6 @@ //! `backup` subcommand use derive_setters::Setters; -use log::info; +use tracing::info; use std::path::PathBuf; diff --git a/crates/core/src/commands/check.rs b/crates/core/src/commands/check.rs index 443e828a..fd8bfe6f 100644 --- a/crates/core/src/commands/check.rs +++ b/crates/core/src/commands/check.rs @@ -9,9 +9,9 @@ use bytes::Bytes; use bytesize::ByteSize; use chrono::{Datelike, Local, NaiveDateTime, Timelike}; use derive_setters::Setters; -use log::{debug, error, warn}; use rand::{prelude::SliceRandom, thread_rng, Rng}; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; +use tracing::{debug, error, warn}; use zstd::stream::decode_all; use crate::{ @@ -202,6 +202,7 @@ pub struct CheckOptions { /// # Panics /// // TODO: Add panics +#[tracing::instrument(skip(repo))] pub(crate) fn check_repository( repo: &Repository, opts: CheckOptions, @@ -350,6 +351,7 @@ fn check_hot_files( /// # Errors /// /// If a file is missing or has a different size +#[tracing::instrument(skip(be, p, _concurrency))] fn check_cache_files( _concurrency: usize, cache: &Cache, diff --git a/crates/core/src/commands/copy.rs b/crates/core/src/commands/copy.rs index 609f540d..1369e5e9 100644 --- a/crates/core/src/commands/copy.rs +++ b/crates/core/src/commands/copy.rs @@ -1,7 +1,7 @@ use std::collections::BTreeSet; -use log::trace; use rayon::prelude::{IntoParallelRefIterator, ParallelBridge, ParallelIterator}; +use tracing::trace; use crate::{ backend::{decrypt::DecryptWriteBackend, node::NodeType}, @@ -41,6 +41,7 @@ pub struct CopySnapshot { /// # Errors /// // TODO: Document errors +#[tracing::instrument(skip(repo, repo_dest, snapshots))] pub(crate) fn copy<'a, Q, R: IndexedFull, P: ProgressBars, S: IndexedIds>( repo: &Repository, repo_dest: &Repository, diff --git a/crates/core/src/commands/init.rs b/crates/core/src/commands/init.rs index f932658c..81965d50 100644 --- a/crates/core/src/commands/init.rs +++ b/crates/core/src/commands/init.rs @@ -1,6 +1,6 @@ //! `init` subcommand -use log::info; +use tracing::info; use crate::{ backend::WriteBackend, diff --git a/crates/core/src/commands/prune.rs b/crates/core/src/commands/prune.rs index d2082f9c..2624a63a 100644 --- a/crates/core/src/commands/prune.rs +++ b/crates/core/src/commands/prune.rs @@ -15,9 +15,9 @@ use derive_more::Add; use derive_setters::Setters; use enumset::{EnumSet, EnumSetType}; use itertools::Itertools; -use log::{info, warn}; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; use serde::{Deserialize, Serialize}; +use tracing::{info, warn}; use crate::{ backend::{ @@ -1182,6 +1182,7 @@ impl PrunePlan { /// TODO! In weird circumstances, should be fixed. #[allow(clippy::significant_drop_tightening)] #[allow(clippy::too_many_lines)] +#[tracing::instrument(skip(repo))] pub(crate) fn prune_repository( repo: &Repository, opts: &PruneOptions, diff --git a/crates/core/src/commands/repair/index.rs b/crates/core/src/commands/repair/index.rs index f2e8dc56..f2c37816 100644 --- a/crates/core/src/commands/repair/index.rs +++ b/crates/core/src/commands/repair/index.rs @@ -1,6 +1,6 @@ //! `repair` index subcommand use derive_setters::Setters; -use log::{debug, info, warn}; +use tracing::{debug, info, warn}; use std::collections::HashMap; diff --git a/crates/core/src/commands/repair/snapshots.rs b/crates/core/src/commands/repair/snapshots.rs index ebf6509c..f0d6d7a3 100644 --- a/crates/core/src/commands/repair/snapshots.rs +++ b/crates/core/src/commands/repair/snapshots.rs @@ -1,6 +1,6 @@ //! `repair snapshots` subcommand use derive_setters::Setters; -use log::{info, warn}; +use tracing::{info, warn}; use std::collections::{BTreeMap, BTreeSet}; diff --git a/crates/core/src/commands/restore.rs b/crates/core/src/commands/restore.rs index 033f9785..a6d26e8d 100644 --- a/crates/core/src/commands/restore.rs +++ b/crates/core/src/commands/restore.rs @@ -1,7 +1,7 @@ //! `restore` subcommand use derive_setters::Setters; -use log::{debug, error, info, trace, warn}; +use tracing::{debug, error, info, trace, warn}; use std::{ cmp::Ordering, @@ -430,6 +430,7 @@ pub(crate) fn set_metadata( /// [`CommandErrorKind::ErrorSettingLength`]: crate::error::CommandErrorKind::ErrorSettingLength /// [`CommandErrorKind::FromRayonError`]: crate::error::CommandErrorKind::FromRayonError #[allow(clippy::too_many_lines)] +#[tracing::instrument(skip(repo))] fn restore_contents( repo: &Repository, dest: &LocalDestination, diff --git a/crates/core/src/index/binarysorted.rs b/crates/core/src/index/binarysorted.rs index 7d0470fc..0dc2370c 100644 --- a/crates/core/src/index/binarysorted.rs +++ b/crates/core/src/index/binarysorted.rs @@ -120,6 +120,7 @@ impl IndexCollector { } // Turns Collector into an index by sorting the entries by ID. + #[tracing::instrument(skip(self))] #[must_use] pub fn into_index(self) -> Index { Index(self.0.map(|_, mut tc| { @@ -223,6 +224,7 @@ impl IntoIterator for Index { type IntoIter = PackIndexes; // Turns Collector into an iterator yielding PackIndex by sorting the entries by pack. + #[tracing::instrument(skip(self))] fn into_iter(mut self) -> Self::IntoIter { for tc in self.0.values_mut() { if let EntriesVariants::FullEntries(entries) = &mut tc.entries { diff --git a/crates/core/src/index/indexer.rs b/crates/core/src/index/indexer.rs index 902f634b..af7cf848 100644 --- a/crates/core/src/index/indexer.rs +++ b/crates/core/src/index/indexer.rs @@ -4,7 +4,7 @@ use std::{ time::{Duration, SystemTime}, }; -use log::warn; +use tracing::warn; use crate::{ backend::decrypt::DecryptWriteBackend, diff --git a/crates/core/src/progress.rs b/crates/core/src/progress.rs index ec6ae209..ae6865ec 100644 --- a/crates/core/src/progress.rs +++ b/crates/core/src/progress.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use log::info; +use tracing::info; /// Trait to report progress information for any rustic action which supports that. /// diff --git a/crates/core/src/repofile/packfile.rs b/crates/core/src/repofile/packfile.rs index 87a2404d..e47430ae 100644 --- a/crates/core/src/repofile/packfile.rs +++ b/crates/core/src/repofile/packfile.rs @@ -1,7 +1,7 @@ use std::num::NonZeroU32; use binrw::{io::Cursor, BinRead, BinWrite}; -use log::trace; +use tracing::trace; use crate::{ backend::{decrypt::DecryptReadBackend, FileType}, diff --git a/crates/core/src/repofile/snapshotfile.rs b/crates/core/src/repofile/snapshotfile.rs index a973bfce..33cc947a 100644 --- a/crates/core/src/repofile/snapshotfile.rs +++ b/crates/core/src/repofile/snapshotfile.rs @@ -12,10 +12,10 @@ use derive_setters::Setters; use dunce::canonicalize; use gethostname::gethostname; use itertools::Itertools; -use log::info; use path_dedot::ParseDot; use serde_derive::{Deserialize, Serialize}; use serde_with::{serde_as, skip_serializing_none, DisplayFromStr}; +use tracing::info; use crate::{ backend::{decrypt::DecryptReadBackend, FileType, FindInBackend}, diff --git a/crates/core/src/repository.rs b/crates/core/src/repository.rs index 607a4264..cd5739ba 100644 --- a/crates/core/src/repository.rs +++ b/crates/core/src/repository.rs @@ -14,8 +14,8 @@ use std::{ use bytes::Bytes; use derive_setters::Setters; -use log::{debug, error, info}; use serde_with::{serde_as, DisplayFromStr}; +use tracing::{debug, error, info}; use crate::{ backend::{ diff --git a/crates/core/src/repository/command_input.rs b/crates/core/src/repository/command_input.rs index 6a258d4d..8671775e 100644 --- a/crates/core/src/repository/command_input.rs +++ b/crates/core/src/repository/command_input.rs @@ -4,9 +4,9 @@ use std::{ str::FromStr, }; -use log::{debug, error, trace, warn}; use serde::{Deserialize, Serialize, Serializer}; use serde_with::{serde_as, DisplayFromStr, PickFirst}; +use tracing::{debug, error, trace, warn}; use crate::{ error::{RepositoryErrorKind, RusticErrorKind}, diff --git a/crates/core/src/repository/warm_up.rs b/crates/core/src/repository/warm_up.rs index 14ea76da..3dbafc44 100644 --- a/crates/core/src/repository/warm_up.rs +++ b/crates/core/src/repository/warm_up.rs @@ -1,8 +1,8 @@ use std::process::Command; use std::thread::sleep; -use log::{debug, error, warn}; use rayon::ThreadPoolBuilder; +use tracing::{debug, error, warn}; use crate::{ backend::{FileType, ReadBackend}, @@ -119,6 +119,7 @@ fn warm_up_command( /// * [`RepositoryErrorKind::FromThreadPoolbilderError`] - If the thread pool could not be created. /// /// [`RepositoryErrorKind::FromThreadPoolbilderError`]: crate::error::RepositoryErrorKind::FromThreadPoolbilderError +#[tracing::instrument(skip(repo, packs))] fn warm_up_repo( repo: &Repository, packs: impl ExactSizeIterator, diff --git a/crates/core/src/vfs/webdavfs.rs b/crates/core/src/vfs/webdavfs.rs index 1813b612..d0014ac6 100644 --- a/crates/core/src/vfs/webdavfs.rs +++ b/crates/core/src/vfs/webdavfs.rs @@ -132,10 +132,12 @@ impl Clone for WebDavFS { impl DavFileSystem for WebDavFS { + #[tracing::instrument(skip(self))] fn metadata<'a>(&'a self, davpath: &'a DavPath) -> FsFuture<'_, Box> { self.symlink_metadata(davpath) } + #[tracing::instrument(skip(self))] fn symlink_metadata<'a>(&'a self, davpath: &'a DavPath) -> FsFuture<'_, Box> { async move { let node = self.node_from_path(davpath)?; @@ -145,6 +147,7 @@ impl( &'a self, davpath: &'a DavPath, @@ -162,6 +165,7 @@ impl( &'a self, path: &'a DavPath, @@ -204,6 +208,7 @@ impl FsFuture<'_, Box> { async move { let meta: Box = Box::new(DavFsMetaData(self.0.clone())); @@ -213,11 +218,13 @@ impl DavDirEntry for DavFsDirEntry { } #[cfg(not(windows))] + #[tracing::instrument(skip(self))] fn name(&self) -> Vec { self.0.name().as_bytes().to_vec() } #[cfg(windows)] + #[tracing::instrument(skip(self))] fn name(&self) -> Vec { self.0 .name() @@ -252,6 +259,7 @@ impl Debug for DavFsFile { } impl DavFile for DavFsFile { + #[tracing::instrument(skip(self))] fn metadata(&mut self) -> FsFuture<'_, Box> { async move { let meta: Box = Box::new(DavFsMetaData(self.node.clone())); @@ -260,14 +268,17 @@ impl DavFile for D .boxed() } + #[tracing::instrument(skip(self, _buf))] fn write_bytes(&mut self, _buf: Bytes) -> FsFuture<'_, ()> { async move { Err(FsError::Forbidden) }.boxed() } + #[tracing::instrument(skip(self, _buf))] fn write_buf(&mut self, _buf: Box) -> FsFuture<'_, ()> { async move { Err(FsError::Forbidden) }.boxed() } + #[tracing::instrument(skip(self))] fn read_bytes(&mut self, count: usize) -> FsFuture<'_, Bytes> { async move { let data = self @@ -281,6 +292,7 @@ impl DavFile for D .boxed() } + #[tracing::instrument(skip(self))] fn seek(&mut self, pos: SeekFrom) -> FsFuture<'_, u64> { async move { match pos { @@ -306,6 +318,7 @@ impl DavFile for D .boxed() } + #[tracing::instrument(skip(self))] fn flush(&mut self) -> FsFuture<'_, ()> { async move { Ok(()) }.boxed() }