-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9300823
commit 10e9fb9
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use log::{debug, error, info}; | ||
|
||
// env_logger | ||
// https://docs.rs/env_logger/latest/env_logger/# | ||
|
||
#[test] | ||
fn ex1() { | ||
env_logger::init(); | ||
// By order of importance: | ||
error!("this is printed by default"); | ||
info!("this is info {}", "message"); | ||
debug!("this is a debug {}", "message"); | ||
} | ||
// $ RUST_LOG=error cargo r ... | ||
// [2023-11-09T02:12:24Z ERROR main] this is printed by default | ||
|
||
// $ RUST_LOG=info cargo r ... | ||
// [2023-11-09T02:12:24Z ERROR main] this is printed by default | ||
// [2023-11-09T02:12:24Z INFO main] this is info | ||
|
||
// $ RUST_LOG=debug cargo r ... | ||
// [2023-11-09T02:12:24Z ERROR main] this is printed by default | ||
// [2023-11-09T02:12:24Z INFO main] this is info | ||
// [2023-11-09T02:12:24Z DEBUG main] this is a debug message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters