mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-18 10:37:40 +00:00
enable logging of salsa events by default
and add logging to tests
This commit is contained in:
parent
395df47016
commit
323e677182
3 changed files with 8 additions and 3 deletions
|
@ -1,11 +1,14 @@
|
|||
use crate::{storage::HasJarsDyn, Event, Runtime};
|
||||
use crate::{storage::HasJarsDyn, DebugWithDb, Event, Runtime};
|
||||
|
||||
pub trait Database: HasJarsDyn + AsSalsaDatabase {
|
||||
/// This function is invoked at key points in the salsa
|
||||
/// runtime. It permits the database to be customized and to
|
||||
/// inject logging or other custom behavior.
|
||||
///
|
||||
/// By default, the event is logged at level debug using
|
||||
/// the standard `log` facade.
|
||||
fn salsa_event(&self, event_fn: Event) {
|
||||
#![allow(unused_variables)]
|
||||
log::debug!("salsa_event: {:?}", event_fn.debug(self));
|
||||
}
|
||||
|
||||
fn salsa_runtime(&self) -> &Runtime;
|
||||
|
|
|
@ -9,4 +9,5 @@ edition = "2021"
|
|||
salsa = { path = "../components/salsa-2022", package = "salsa-2022" }
|
||||
expect-test = "1.4.0"
|
||||
parking_lot = "0.12.1"
|
||||
|
||||
test-log = "0.2.11"
|
||||
env_logger = "*"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use salsa_2022_tests::{HasLogger, Logger};
|
||||
|
||||
use expect_test::expect;
|
||||
use test_log::test;
|
||||
|
||||
#[salsa::jar(db = Db)]
|
||||
struct Jar(MyInput, MyTracked, final_result, intermediate_result);
|
||||
|
|
Loading…
Reference in a new issue