Skip to content

Commit bdbaf80

Browse files
authored
examples: add note to examples that they are for tracing 0.2.0 (#3099)
It is not uncommon that users who are new to tracing look at the examples in the `master` branch of the repository and find that they don't compile. This is because they are examples which compile with the code from the master branch, which is for the as yet unreleased tracing 0.2.0 ecosystem. Users should instead go to the `v0.1.x` branch to find examples compatible with the crates published on crates.io. This change adds a doc-comment to the beginning of every example file informing the user of this fact and suggesting that they check out the `v0.1.x` branch instead.
1 parent 2d30094 commit bdbaf80

39 files changed

+139
-44
lines changed

examples/examples/all-levels.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
13
use tracing::Level;
24

35
#[no_mangle]

examples/examples/appender-multifile.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
3+
//!
14
//! This example demonstrates the use of multiple files with
25
//! `tracing-appender`'s `RollingFileAppender`
3-
//!
46
use tracing_appender::rolling;
57
use tracing_subscriber::fmt::writer::MakeWriterExt;
68

examples/examples/async-fn.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
3+
//!
14
//! Demonstrates using the `trace` attribute macro to instrument `async`
25
//! functions.
36
//!

examples/examples/attrs-args.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
13
#![deny(rust_2018_idioms)]
24

35
use tracing::{debug, info};

examples/examples/attrs-basic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
13
#![deny(rust_2018_idioms)]
24

35
use tracing::{debug, info, span, Level};

examples/examples/attrs-literal-field-names.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
13
#![deny(rust_2018_idioms)]
24

35
use tracing::{debug, span, Level};

examples/examples/counters.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
13
#![deny(rust_2018_idioms)]
24

35
use tracing::{

examples/examples/custom-error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
3+
//!
14
//! This example demonstrates using the `tracing-error` crate's `SpanTrace` type
25
//! to attach a trace context to a custom error type.
36
#![deny(rust_2018_idioms)]

examples/examples/echo.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
3+
//!
14
//! A "hello world" echo server [from Tokio][echo-example]
25
//!
36
//! This server will create a TCP listener, accept connections in a loop, and

examples/examples/fmt-compact.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
2+
//! release examples, please see the `v0.1.x` branch instead.
13
#![deny(rust_2018_idioms)]
24
#[path = "fmt/yak_shave.rs"]
35
mod yak_shave;

0 commit comments

Comments
 (0)