blob: 8d3d267509267836362040b038bd3062b5906ca1 [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;
Fabio Utzigffc673e2019-10-30 09:22:04 -030010use std::sync::Once;
David Brownca7b5d32017-11-03 08:37:38 -060011
Fabio Utzigffc673e2019-10-30 09:22:04 -030012static INIT: Once = Once::new();
David Brownca7b5d32017-11-03 08:37:38 -060013
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}