mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-02-03 18:06:02 -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));
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
pub fn init() {
|
||||
INIT.call_once(|| {
|
||||
base::tracing_setup::install();
|
||||
base::tracing_setup::install_for_tests();
|
||||
env::set_var("TZ", "America/Los_Angeles");
|
||||
time::tzset();
|
||||
crate::auth::set_test_config();
|
||||
|
Loading…
x
Reference in New Issue
Block a user