Skip to content

Commit

Permalink
Merge pull request #516 from davidbarsky/master
Browse files Browse the repository at this point in the history
chore: use tracing instead of log
  • Loading branch information
nikomatsakis authored Jul 23, 2024
2 parents f5f21cf + 86f06d8 commit 2f4f80f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion src/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
2 changes: 1 addition & 1 deletion src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/function/backdate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
6 changes: 3 additions & 3 deletions src/function/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
);
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions src/function/maybe_changed_after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:#?}",
);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/function/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<V> Memo<V> {
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,
Expand Down
2 changes: 1 addition & 1 deletion src/function/specify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down Expand Up @@ -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
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/local_state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use log::debug;
use tracing::debug;

use crate::durability::Durability;
use crate::key::DatabaseKeyIndex;
Expand Down

0 comments on commit 2f4f80f

Please sign in to comment.