How to initialize the logger for integration tests?

后端 未结 6 1212
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 18:07

I have a crate with production code in the src directory and integration tests in the tests directory. The production code uses log ma

6条回答
  •  时光说笑
    2020-12-01 18:41

    For now, you can just re-initialize the logger at the top of every test and ignore the error. It's not a pretty solution but it works and is perfectly safe.

    let _ = env_logger::init();
    
    // your test code...
    

提交回复
热议问题