Lines Matching +full:test +full:- +full:docs
4 [](https://docs.rs/env_logger)
5 [](https://env-logger-rs.github.io…
13 …n executables (binary projects). Libraries should use the [`log`](https://docs.rs/log) crate inste…
45 [2018-11-03T06:09:06Z INFO default] starting up
55 [2018-11-03T06:09:06Z INFO default] starting up
59 case names. Where our docs do use other forms, they do so in the context of
63 The log levels that may be specified correspond to the [`log::Level`][level-enum]
72 [level-enum]: https://docs.rs/log/latest/log/enum.Level.html "log::Level (docs.rs)"
78 …sides an environment variable. See [the examples](https://github.com/env-logger-rs/env_logger/tree…
82 Tests can use the `env_logger` crate to see log messages generated during that test:
88 [dev-dependencies]
96 fn add_one(num: i32) -> i32 {
101 #[cfg(test)]
109 #[test]
113 info!("can log from the test too");
117 #[test]
121 info!("logging from another test");
122 assert_eq!(-7, add_one(-8));
127 Assuming the module under test is called `my_lib`, running the tests with the
131 $ RUST_LOG=my_lib=info cargo test
132 Running target/debug/my_lib-...
135 [INFO my_lib::tests] logging from another test
136 [INFO my_lib] add_one called with -8
137 test tests::it_handles_negative_numbers ... ok
138 [INFO my_lib::tests] can log from the test too
140 test tests::it_adds_one ... ok
142 test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured
145 Note that `env_logger::try_init()` needs to be called in each test in which you
147 run in parallel means that logging output may be interleaved with test output.
149 running one test by specifying its name as an argument to the test binaries as
150 directed by the `cargo test` help docs:
153 $ RUST_LOG=my_lib=info cargo test it_adds_one
154 Running target/debug/my_lib-...
156 running 1 test
157 [INFO my_lib::tests] can log from the test too
159 test tests::it_adds_one ... ok
161 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
181 The default format won't optimise for long-term stability, and explicitly makes no guarantees about…