Skip to content

Commit

Permalink
tests: Set default log level
Browse files Browse the repository at this point in the history
  • Loading branch information
cdamian committed Oct 24, 2023
1 parent e128dc0 commit c6ee97c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
// GNU General Public License for more details.

use sp_std::sync::atomic::{AtomicUsize, Ordering};
use tracing_subscriber::filter::LevelFilter;

static GLOBAL_INIT: AtomicUsize = AtomicUsize::new(UNINITIALIZED);

const UNINITIALIZED: usize = 0;
const INITIALIZING: usize = 1;
const INITIALIZED: usize = 2;

const LOG_LEVEL: LevelFilter = LevelFilter::DEBUG;

pub fn init_logs() {
if GLOBAL_INIT
.compare_exchange(
Expand All @@ -28,6 +32,8 @@ pub fn init_logs() {
.is_ok()
{
GLOBAL_INIT.store(INITIALIZED, Ordering::SeqCst);
tracing_subscriber::fmt::init();
tracing_subscriber::fmt::fmt()
.with_max_level(LOG_LEVEL)
.init();
}
}

0 comments on commit c6ee97c

Please sign in to comment.