mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-09-28 21:42:15 +00:00
tracing-serde: Use path deps to tracing-core and tracing. (#130)
This addresses a TODO in the `Cargo.toml`.
This commit is contained in:
parent
ce37de8982
commit
2649a7bab4
@ -6,16 +6,8 @@ license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
serde = "1"
|
||||
|
||||
[dependencies.tracing-core]
|
||||
# TODO: replace this with a path dependency on the local `tracing-core`.
|
||||
package = "tokio-trace-core"
|
||||
version = "0.2.0"
|
||||
tracing-core = { version = "0.1", path = "../tracing-core" }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
[dev-dependencies.tracing]
|
||||
# TODO: replace this with a path dependency on the local `tracing`.
|
||||
package = "tokio-trace"
|
||||
version = "0.1"
|
||||
tracing = { version = "0.1", path = "../tracing" }
|
||||
|
@ -85,19 +85,19 @@ impl Subscriber for JsonSubscriber {
|
||||
}
|
||||
|
||||
fn shave(yak: usize) -> bool {
|
||||
span!(Level::TRACE, "shave", yak = yak).enter(|| {
|
||||
debug!(
|
||||
message = "hello! I'm gonna shave a yak.",
|
||||
excitement = "yay!"
|
||||
);
|
||||
if yak == 3 {
|
||||
warn!(target: "yak_events", "could not locate yak!");
|
||||
false
|
||||
} else {
|
||||
trace!(target: "yak_events", "yak shaved successfully");
|
||||
true
|
||||
}
|
||||
})
|
||||
let span = span!(Level::TRACE, "shave", yak = yak);
|
||||
let _e = span.enter();
|
||||
debug!(
|
||||
message = "hello! I'm gonna shave a yak.",
|
||||
excitement = "yay!"
|
||||
);
|
||||
if yak == 3 {
|
||||
warn!(target: "yak_events", "could not locate yak!");
|
||||
false
|
||||
} else {
|
||||
trace!(target: "yak_events", "yak shaved successfully");
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -110,7 +110,7 @@ fn main() {
|
||||
let mut number_shaved = 0;
|
||||
debug!("preparing to shave {} yaks", number_of_yaks);
|
||||
|
||||
span!(Level::TRACE, "shaving_yaks", yaks_to_shave = number_of_yaks).enter(|| {
|
||||
span!(Level::TRACE, "shaving_yaks", yaks_to_shave = number_of_yaks).in_scope(|| {
|
||||
info!("shaving yaks");
|
||||
|
||||
for yak in 1..=number_of_yaks {
|
||||
|
Loading…
x
Reference in New Issue
Block a user