chore: use tracing instead of log

This commit is contained in:
David Barsky 2024-07-22 18:01:50 -04:00
parent f5f21cf55e
commit 86f06d8485
10 changed files with 17 additions and 17 deletions

View file

@ -14,8 +14,8 @@ crossbeam = "0.8.1"
dashmap = "6.0.1" dashmap = "6.0.1"
hashlink = "0.9.1" hashlink = "0.9.1"
indexmap = "2" indexmap = "2"
log = "0.4.5"
orx-concurrent-vec = "1.10.0" orx-concurrent-vec = "1.10.0"
tracing = "0.1"
parking_lot = "0.12.1" parking_lot = "0.12.1"
rustc-hash = "2.0.0" rustc-hash = "2.0.0"
salsa-macro-rules = { version = "0.1.0", path = "components/salsa-macro-rules" } salsa-macro-rules = { version = "0.1.0", path = "components/salsa-macro-rules" }

View file

@ -34,7 +34,7 @@ impl Cycle {
} }
pub(crate) fn throw(self) -> ! { pub(crate) fn throw(self) -> ! {
log::debug!("throwing cycle {:?}", self); tracing::debug!("throwing cycle {:?}", self);
std::panic::resume_unwind(Box::new(self)) std::panic::resume_unwind(Box::new(self))
} }

View file

@ -11,7 +11,7 @@ pub trait Database: DatabaseGen {
/// By default, the event is logged at level debug using /// By default, the event is logged at level debug using
/// the standard `log` facade. /// the standard `log` facade.
fn salsa_event(&self, event: Event) { 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 /// A "synthetic write" causes the system to act *as though* some

View file

@ -23,7 +23,7 @@ where
if revisions.durability >= old_memo.revisions.durability if revisions.durability >= old_memo.revisions.durability
&& C::should_backdate_value(old_value, value) && C::should_backdate_value(old_value, value)
{ {
log::debug!( tracing::debug!(
"value is equal, back-dating to {:?}", "value is equal, back-dating to {:?}",
old_memo.revisions.changed_at, old_memo.revisions.changed_at,
); );

View file

@ -31,7 +31,7 @@ where
let revision_now = runtime.current_revision(); let revision_now = runtime.current_revision();
let database_key_index = active_query.database_key_index; 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 { db.salsa_event(Event {
runtime_id: runtime.id(), runtime_id: runtime.id(),
@ -47,7 +47,7 @@ where
let value = match Cycle::catch(|| C::execute(db, C::id_to_input(db, key))) { let value = match Cycle::catch(|| C::execute(db, C::id_to_input(db, key))) {
Ok(v) => v, Ok(v) => v,
Err(cycle) => { Err(cycle) => {
log::debug!( tracing::debug!(
"{database_key_index:?}: caught cycle {cycle:?}, have strategy {:?}", "{database_key_index:?}: caught cycle {cycle:?}, have strategy {:?}",
C::CYCLE_STRATEGY C::CYCLE_STRATEGY
); );
@ -98,7 +98,7 @@ where
let stamped_value = revisions.stamped_value(value); 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 stamped_value
} }

View file

@ -28,7 +28,7 @@ where
loop { loop {
let database_key_index = self.database_key_index(key); 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. // Check if we have a verified version: this is the hot path.
let memo_guard = self.memo_map.get(key); let memo_guard = self.memo_map.get(key);
@ -70,7 +70,7 @@ where
None => return Some(true), None => return Some(true),
}; };
log::debug!( tracing::debug!(
"{database_key_index:?}: maybe_changed_after_cold, successful claim, \ "{database_key_index:?}: maybe_changed_after_cold, successful claim, \
revision = {revision:?}, old_memo = {old_memo:#?}", revision = {revision:?}, old_memo = {old_memo:#?}",
); );
@ -106,7 +106,7 @@ where
let verified_at = memo.verified_at.load(); let verified_at = memo.verified_at.load();
let revision_now = runtime.current_revision(); 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 { if verified_at == revision_now {
// Already verified. // Already verified.
@ -141,7 +141,7 @@ where
let runtime = db.runtime(); let runtime = db.runtime();
let database_key_index = active_query.database_key_index; 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) { if self.shallow_verify_memo(db, runtime, database_key_index, old_memo) {
return true; return true;

View file

@ -132,7 +132,7 @@ impl<V> Memo<V> {
pub(super) fn check_durability(&self, runtime: &Runtime) -> bool { pub(super) fn check_durability(&self, runtime: &Runtime) -> bool {
let last_changed = runtime.last_changed_revision(self.revisions.durability); let last_changed = runtime.last_changed_revision(self.revisions.durability);
let verified_at = self.verified_at.load(); let verified_at = self.verified_at.load();
log::debug!( tracing::debug!(
"check_durability(last_changed={:?} <= verified_at={:?}) = {:?}", "check_durability(last_changed={:?} <= verified_at={:?}) = {:?}",
last_changed, last_changed,
self.verified_at, self.verified_at,

View file

@ -87,7 +87,7 @@ where
revisions, 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); self.insert_memo(db, key, memo);
} }

View file

@ -362,7 +362,7 @@ impl Runtime {
database_key_index: DatabaseKeyIndex, database_key_index: DatabaseKeyIndex,
to_id: RuntimeId, to_id: RuntimeId,
) { ) {
log::debug!( tracing::debug!(
"unblock_cycle_and_maybe_throw(database_key={:?})", "unblock_cycle_and_maybe_throw(database_key={:?})",
database_key_index database_key_index
); );
@ -404,7 +404,7 @@ impl Runtime {
Cycle::new(Arc::new(v)) 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; // We can remove the cycle participants from the list of dependencies;
// they are a strongly connected component (SCC) and we only care about // they are a strongly connected component (SCC) and we only care about
@ -427,7 +427,7 @@ impl Runtime {
} }
}) })
.for_each(|aq| { .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); aq.take_inputs_from(&cycle_query);
assert!(aq.cycle.is_none()); assert!(aq.cycle.is_none());
aq.cycle = Some(cycle.clone()); aq.cycle = Some(cycle.clone());

View file

@ -1,4 +1,4 @@
use log::debug; use tracing::debug;
use crate::durability::Durability; use crate::durability::Durability;
use crate::key::DatabaseKeyIndex; use crate::key::DatabaseKeyIndex;