blob: 28a189a4823c0ebf4001d554eb0655411a9904e4 [file] [log] [blame]
David Brownca7b5d32017-11-03 08:37:38 -06001//! Logging support for the test framework.
2//!
3//! https://stackoverflow.com/questions/30177845/how-to-initialize-the-logger-for-integration-tests
4//!
5//! The test framework runs the tests, possibly simultaneously, and in various orders. This helper
6//! function, which should be called at the beginning of each test, will setup logging for all of
7//! the tests.
8
9use env_logger;
10use std::sync::{Once, ONCE_INIT};
11
12static INIT: Once = ONCE_INIT;
13
14/// Setup the logging system. Intended to be called at the beginning of each test.
15pub fn setup() {
16 INIT.call_once(|| {
Fabio Utzig25d7b0f2019-01-10 11:01:04 -020017 env_logger::init();
David Brownca7b5d32017-11-03 08:37:38 -060018 });
19}