diff --git a/Cargo.toml b/Cargo.toml index 43ee2a74b..09e1f3d37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,8 @@ crossbeam = "0.8.1" dashmap = "6.0.1" hashlink = "0.9.1" indexmap = "2" -log = "0.4.5" orx-concurrent-vec = "1.10.0" +tracing = "0.1" parking_lot = "0.12.1" rustc-hash = "2.0.0" salsa-macro-rules = { version = "0.1.0", path = "components/salsa-macro-rules" } diff --git a/src/cycle.rs b/src/cycle.rs index 6ed227aac..e9c5a4ecd 100644 --- a/src/cycle.rs +++ b/src/cycle.rs @@ -34,7 +34,7 @@ impl Cycle { } pub(crate) fn throw(self) -> ! { - log::debug!("throwing cycle {:?}", self); + tracing::debug!("throwing cycle {:?}", self); std::panic::resume_unwind(Box::new(self)) } diff --git a/src/database.rs b/src/database.rs index 00afc3c1a..8a9a092f0 100644 --- a/src/database.rs +++ b/src/database.rs @@ -11,7 +11,7 @@ pub trait Database: DatabaseGen { /// By default, the event is logged at level debug using /// the standard `log` facade. fn salsa_event(&self, event: Event) { - log::debug!("salsa_event: {:?}", event) + tracing::debug!("salsa_event: {:?}", event) } /// A "synthetic write" causes the system to act *as though* some diff --git a/src/function/backdate.rs b/src/function/backdate.rs index fc55b9940..65709d075 100644 --- a/src/function/backdate.rs +++ b/src/function/backdate.rs @@ -23,7 +23,7 @@ where if revisions.durability >= old_memo.revisions.durability && C::should_backdate_value(old_value, value) { - log::debug!( + tracing::debug!( "value is equal, back-dating to {:?}", old_memo.revisions.changed_at, ); diff --git a/src/function/execute.rs b/src/function/execute.rs index 9374ee857..06b33ff3b 100644 --- a/src/function/execute.rs +++ b/src/function/execute.rs @@ -31,7 +31,7 @@ where let revision_now = runtime.current_revision(); let database_key_index = active_query.database_key_index; - log::info!("{:?}: executing query", database_key_index); + tracing::info!("{:?}: executing query", database_key_index); db.salsa_event(Event { runtime_id: runtime.id(), @@ -47,7 +47,7 @@ where let value = match Cycle::catch(|| C::execute(db, C::id_to_input(db, key))) { Ok(v) => v, Err(cycle) => { - log::debug!( + tracing::debug!( "{database_key_index:?}: caught cycle {cycle:?}, have strategy {:?}", C::CYCLE_STRATEGY ); @@ -98,7 +98,7 @@ where let stamped_value = revisions.stamped_value(value); - log::debug!("{database_key_index:?}: read_upgrade: result.revisions = {revisions:#?}"); + tracing::debug!("{database_key_index:?}: read_upgrade: result.revisions = {revisions:#?}"); stamped_value } diff --git a/src/function/maybe_changed_after.rs b/src/function/maybe_changed_after.rs index 88f3d95f6..c980f4b32 100644 --- a/src/function/maybe_changed_after.rs +++ b/src/function/maybe_changed_after.rs @@ -28,7 +28,7 @@ where loop { let database_key_index = self.database_key_index(key); - log::debug!("{database_key_index:?}: maybe_changed_after(revision = {revision:?})"); + tracing::debug!("{database_key_index:?}: maybe_changed_after(revision = {revision:?})"); // Check if we have a verified version: this is the hot path. let memo_guard = self.memo_map.get(key); @@ -70,7 +70,7 @@ where None => return Some(true), }; - log::debug!( + tracing::debug!( "{database_key_index:?}: maybe_changed_after_cold, successful claim, \ revision = {revision:?}, old_memo = {old_memo:#?}", ); @@ -106,7 +106,7 @@ where let verified_at = memo.verified_at.load(); let revision_now = runtime.current_revision(); - log::debug!("{database_key_index:?}: shallow_verify_memo(memo = {memo:#?})",); + tracing::debug!("{database_key_index:?}: shallow_verify_memo(memo = {memo:#?})",); if verified_at == revision_now { // Already verified. @@ -141,7 +141,7 @@ where let runtime = db.runtime(); let database_key_index = active_query.database_key_index; - log::debug!("{database_key_index:?}: deep_verify_memo(old_memo = {old_memo:#?})",); + tracing::debug!("{database_key_index:?}: deep_verify_memo(old_memo = {old_memo:#?})",); if self.shallow_verify_memo(db, runtime, database_key_index, old_memo) { return true; diff --git a/src/function/memo.rs b/src/function/memo.rs index ec6636acc..ec41210d8 100644 --- a/src/function/memo.rs +++ b/src/function/memo.rs @@ -132,7 +132,7 @@ impl Memo { pub(super) fn check_durability(&self, runtime: &Runtime) -> bool { let last_changed = runtime.last_changed_revision(self.revisions.durability); let verified_at = self.verified_at.load(); - log::debug!( + tracing::debug!( "check_durability(last_changed={:?} <= verified_at={:?}) = {:?}", last_changed, self.verified_at, diff --git a/src/function/specify.rs b/src/function/specify.rs index cbd1740fe..95abb1f27 100644 --- a/src/function/specify.rs +++ b/src/function/specify.rs @@ -87,7 +87,7 @@ where revisions, }; - log::debug!("specify: about to add memo {:#?} for key {:?}", memo, key); + tracing::debug!("specify: about to add memo {:#?} for key {:?}", memo, key); self.insert_memo(db, key, memo); } diff --git a/src/runtime.rs b/src/runtime.rs index 300f3d497..b8e3d177c 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -362,7 +362,7 @@ impl Runtime { database_key_index: DatabaseKeyIndex, to_id: RuntimeId, ) { - log::debug!( + tracing::debug!( "unblock_cycle_and_maybe_throw(database_key={:?})", database_key_index ); @@ -404,7 +404,7 @@ impl Runtime { Cycle::new(Arc::new(v)) }; - log::debug!("cycle {cycle:?}, cycle_query {cycle_query:#?}"); + tracing::debug!("cycle {cycle:?}, cycle_query {cycle_query:#?}"); // We can remove the cycle participants from the list of dependencies; // they are a strongly connected component (SCC) and we only care about @@ -427,7 +427,7 @@ impl Runtime { } }) .for_each(|aq| { - log::debug!("marking {:?} for fallback", aq.database_key_index); + tracing::debug!("marking {:?} for fallback", aq.database_key_index); aq.take_inputs_from(&cycle_query); assert!(aq.cycle.is_none()); aq.cycle = Some(cycle.clone()); diff --git a/src/runtime/local_state.rs b/src/runtime/local_state.rs index 2619d85ab..682434af1 100644 --- a/src/runtime/local_state.rs +++ b/src/runtime/local_state.rs @@ -1,4 +1,4 @@ -use log::debug; +use tracing::debug; use crate::durability::Durability; use crate::key::DatabaseKeyIndex;