-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from baoyachi/issue/34
Add target feature example
- Loading branch information
Showing
4 changed files
with
53 additions
and
7 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[workspace.package] | ||
version = "1.7.0" | ||
version = "1.7.1" | ||
edition = "2021" | ||
authors = ["baoyachi <[email protected]>"] | ||
description = "A simple log. It's really simple use" | ||
|
@@ -36,7 +36,7 @@ convert_case = "0.6.0" | |
[dependencies.simple-log-derive] | ||
path = "simple-log-derive" | ||
optional = true | ||
version = "1.7.0" | ||
version = "1" | ||
|
||
[dev-dependencies] | ||
serde_json = "1" | ||
|
@@ -49,3 +49,8 @@ members = ["./", "simple-log-derive"] | |
|
||
[features] | ||
target = ["simple-log-derive"] | ||
|
||
[[example]] | ||
name = "target" | ||
path = "examples/target.rs" | ||
required-features = ["target"] |
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,41 @@ | ||
//! `cargo run --example console` | ||
//! | ||
//! With OutPut | ||
//! ```bash | ||
//! 2024-08-20 15:43:09.309146000 [TRACE] [ctrl] <examples/target.rs:18>:test target trace | ||
//! 2024-08-20 15:43:09.309336000 [TRACE] [parser] <examples/target.rs:19>:test target trace | ||
//! 2024-08-20 15:43:09.309345000 [DEBUG] [target] <examples/target.rs:21>:test target debug | ||
//! 2024-08-20 15:43:09.309352000 [DEBUG] [ctrl] <examples/target.rs:22>:test target debug | ||
//! 2024-08-20 15:43:09.309358000 [DEBUG] [parser] <examples/target.rs:23>:test target debug | ||
//! 2024-08-20 15:43:09.309364000 [INFO] [target] <examples/target.rs:25>:test target info | ||
//! 2024-08-20 15:43:09.309371000 [INFO] [ctrl] <examples/target.rs:26>:test target info | ||
//! 2024-08-20 15:43:09.309377000 [INFO] [parser] <examples/target.rs:27>:test target info | ||
//! 2024-08-20 15:43:09.309383000 [WARN] [target] <examples/target.rs:29>:test target warn | ||
//! 2024-08-20 15:43:09.309389000 [ERROR] [target] <examples/target.rs:30>:test target error | ||
//! ``` | ||
|
||
#[macro_use] | ||
extern crate simple_log; | ||
|
||
fn main() -> Result<(), String> { | ||
simple_log::console("trace")?; | ||
|
||
simple_log::log_target!(ctrl); | ||
simple_log::log_target!(parser); | ||
|
||
trace_ctrl!("test target trace"); | ||
trace_parser!("test target trace"); | ||
|
||
debug!("test target debug"); | ||
debug_ctrl!("test target debug"); | ||
debug_parser!("test target debug"); | ||
|
||
info!("test target info"); | ||
info_ctrl!("test target info"); | ||
info_parser!("test target info"); | ||
|
||
warn!("test target warn"); | ||
error!("test target error"); | ||
|
||
Ok(()) | ||
} |