lib: add init_debug to configure better debugging defaults (e.g. parallelism)

This commit is contained in:
2022-07-17 13:58:16 -07:00
parent 82e72e9e14
commit ccbaa39fcf

View File

@@ -26,8 +26,19 @@ pub use sim::*;
// B = mu_r*H + M
// For a vacuum, B = H
/// optional: calling this enables preferred logging defaults
pub fn init_logging() {
let conf = env_logger::Env::new().default_filter_or("INFO,wgpu_core=WARN");
env_logger::Builder::from_env(conf).init();
info!("logging initialized");
}
/// optional: calling this tunes the library to provide better instrumentation for debugging
/// (at an extreme cost to perf)
pub fn init_debug() {
rayon::ThreadPoolBuilder::new()
.num_threads(1)
.build_global()
.unwrap();
info!("running with debug rayon");
}