// SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
// SPDX-License-Identifier: BSD-2-Clause
//! Set up the logging framework for the tests.
//!
//! This kind of invalidates the `DRY` principle, but here we go :)

use std::sync::LazyLock;

use log::{LevelFilter, debug};
use simple_logger::SimpleLogger;

static LOGGER_INIT: LazyLock<()> = LazyLock::new(|| {
    if SimpleLogger::new()
        .with_level(LevelFilter::Trace)
        .init()
        .is_err()
    {
        debug!("Somebody set up us the logger");
    }
});

/// Initialize a logger.
pub fn setup_test_logging() {
    *LOGGER_INIT;
}
