blob: c62e0076c618fe285bba5bddab57df0d250e8ee2 [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(|| {
17 env_logger::init().unwrap();
18 });
19}