Merge branch 'main' into cn/file-path-display

pull/24376/head
Carol (Nichols || Goulding) 2021-02-10 10:46:59 -05:00 committed by GitHub
commit 8d14566fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -9,3 +9,4 @@ dotenv = "0.15.0"
env_logger = "0.7.1"
tempfile = "3.1.0"
tracing = "0.1"

View File

@ -6,7 +6,10 @@
clippy::use_self
)]
use std::{env, f64, sync::Arc};
use std::{
env, f64,
sync::{Arc, Once},
};
pub use tempfile;
pub mod tracing;
@ -80,9 +83,17 @@ pub fn tag_key_bytes_to_strings(bytes: Vec<u8>) -> String {
}
}
static LOG_SETUP: Once = Once::new();
/// Enables debug logging. This function can be called more than once
pub fn enable_logging() {
std::env::set_var("RUST_LOG", "debug");
env_logger::init();
// ensure the global has been initialized
LOG_SETUP.call_once(|| {
// TODO honor any existing RUST_LOG level (and maybe not start
// logging unless it is set??)
std::env::set_var("RUST_LOG", "debug");
env_logger::init();
})
}
#[macro_export]