| 1 | //! Set the `RUST_LOG` environment variable and run this example to see the output change. |
| 2 | //! |
| 3 | //! Valid values are `OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, and `TRACE`. |
| 4 | //! |
| 5 | //! ```shell |
| 6 | //! RUST_LOG=WARN cargo run --example init_with_env |
| 7 | //! ``` |
| 8 | //! |
| 9 | //! It should also work if the environment variable is not set: |
| 10 | //! |
| 11 | //! ```shell |
| 12 | //! cargo run --example init_with_env |
| 13 | //! ``` |
| 14 | use simple_logger; |
| 15 | |
| 16 | fn main() { |
| 17 | simple_logger::init_with_env().unwrap(); |
| 18 | |
| 19 | log::trace!("This is an example message."); |
| 20 | log::debug!("This is an example message."); |
| 21 | log::info!("This is an example message."); |
| 22 | log::warn!("This is an example message."); |
| 23 | log::error!("This is an example message."); |
| 24 | } |