mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-02-13 06:38:09 -05:00
let libtest capture logs
This commit is contained in:
parent
faba358925
commit
2a8c1bb632
@ -154,3 +154,19 @@ pub fn install() {
|
|||||||
std::panic::set_hook(Box::new(&panic_hook));
|
std::panic::set_hook(Box::new(&panic_hook));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn install_for_tests() {
|
||||||
|
let filter = tracing_subscriber::EnvFilter::builder()
|
||||||
|
.with_default_directive(tracing_subscriber::filter::LevelFilter::INFO.into())
|
||||||
|
.with_env_var("MOONFIRE_LOG")
|
||||||
|
.from_env_lossy();
|
||||||
|
tracing_log::LogTracer::init().unwrap();
|
||||||
|
let sub = tracing_subscriber::registry().with(
|
||||||
|
tracing_subscriber::fmt::Layer::new()
|
||||||
|
.with_test_writer()
|
||||||
|
.with_timer(ChronoTimer)
|
||||||
|
.with_thread_names(true)
|
||||||
|
.with_filter(filter),
|
||||||
|
);
|
||||||
|
tracing::subscriber::set_global_default(sub).unwrap();
|
||||||
|
}
|
||||||
|
@ -38,7 +38,7 @@ pub const TEST_VIDEO_SAMPLE_ENTRY_DATA: &[u8] =
|
|||||||
/// * use a fast but insecure password hashing format.
|
/// * use a fast but insecure password hashing format.
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
base::tracing_setup::install();
|
base::tracing_setup::install_for_tests();
|
||||||
env::set_var("TZ", "America/Los_Angeles");
|
env::set_var("TZ", "America/Los_Angeles");
|
||||||
time::tzset();
|
time::tzset();
|
||||||
crate::auth::set_test_config();
|
crate::auth::set_test_config();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user