Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/examples/all-levels.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
use tracing::Level;

#[no_mangle]
Expand Down
4 changes: 3 additions & 1 deletion examples/examples/appender-multifile.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This example demonstrates the use of multiple files with
//! `tracing-appender`'s `RollingFileAppender`
//!
use tracing_appender::rolling;
use tracing_subscriber::fmt::writer::MakeWriterExt;

Expand Down
3 changes: 3 additions & 0 deletions examples/examples/async-fn.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! Demonstrates using the `trace` attribute macro to instrument `async`
//! functions.
//!
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/attrs-args.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]

use tracing::{debug, info};
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/attrs-basic.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]

use tracing::{debug, info, span, Level};
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/attrs-literal-field-names.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]

use tracing::{debug, span, Level};
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/counters.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]

use tracing::{
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/custom-error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This example demonstrates using the `tracing-error` crate's `SpanTrace` type
//! to attach a trace context to a custom error type.
#![deny(rust_2018_idioms)]
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/echo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! A "hello world" echo server [from Tokio][echo-example]
//!
//! This server will create a TCP listener, accept connections in a loop, and
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/fmt-compact.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
#[path = "fmt/yak_shave.rs"]
mod yak_shave;
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/fmt-custom-event.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
#[path = "fmt/yak_shave.rs"]
mod yak_shave;
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/fmt-custom-field.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This example demonstrates overriding the way `tracing-subscriber`'s
//! `FmtSubscriber` formats fields on spans and events, using a closure.
//!
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/fmt-json.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
#[path = "fmt/yak_shave.rs"]
mod yak_shave;
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/fmt-multiple-writers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! An example demonstrating how `fmt::Subcriber` can write to multiple
//! destinations (in this instance, `stdout` and a file) simultaneously.

Expand Down
2 changes: 2 additions & 0 deletions examples/examples/fmt-pretty.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
#[path = "fmt/yak_shave.rs"]
mod yak_shave;
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/fmt-source-locations.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! Demonstrates displaying events' source code locations with the `fmt`
//! subscriber.
#![deny(rust_2018_idioms)]
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/fmt-stderr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
use std::io;
use tracing::error;
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
#[path = "fmt/yak_shave.rs"]
mod yak_shave;
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/fmt/yak_shave.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
use snafu::{ResultExt, Snafu};
use std::error::Error;
use thiserror::Error;
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/futures-proxy-server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! A proxy that forwards data to another server and forwards that server's
//! responses back to clients.
//!
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/hyper-echo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]

use http::{Method, Request, Response, StatusCode};
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/inferno-flame.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
use std::{
env,
fs::File,
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/instrumented-error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This example demonstrates using the `tracing-error` crate's `SpanTrace` type
//! to attach a trace context to a custom error type.
#![deny(rust_2018_idioms)]
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/journald.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
use tracing::{error, info};
use tracing_subscriber::prelude::*;
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/log.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
fn main() {
tracing_subscriber::fmt()
.with_max_level(tracing::Level::TRACE)
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/map-traced-error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! An example on composing errors inside of a `TracedError`, such that the
//! SpanTrace captured is captured when creating the inner error, but still wraps
//! the outer error.
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/panic_hook.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This example demonstrates how `tracing` events can be recorded from within a
//! panic hook, capturing the span context in which the program panicked.
//!
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/serde-yak-shave.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
use std::sync::atomic::{AtomicUsize, Ordering};

use tracing::debug;
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/sloggish/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! A simple example demonstrating how one might implement a custom
//! collector.
//!
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/sloggish/sloggish_collector.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
use nu_ansi_term::{Color, Style};
use tracing::{
field::{Field, Visit},
Expand Down
16 changes: 9 additions & 7 deletions examples/examples/spawny-thing.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//! This is a example showing how information is scoped.
//!
//! You can run this example by running the following command in a terminal
//!
//! ```
//! cargo run --example spawny_thing
//! ```
#![deny(rust_2018_idioms)]

/// This is a example showing how information is scoped.
///
/// You can run this example by running the following command in a terminal
///
/// ```
/// cargo run --example spawny_thing
/// ```
use futures::future::join_all;
use std::error::Error;
use tracing::{debug, info};
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/subscriber-filter.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
#![deny(rust_2018_idioms)]
#[path = "fmt/yak_shave.rs"]
mod yak_shave;
Expand Down
39 changes: 21 additions & 18 deletions examples/examples/thread-info.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This is a example showing how thread info can be displayed when
//! formatting events with `tracing_subscriber::fmt`. This is useful
//! as `tracing` spans can be entered by multiple threads concurrently,
//! or move across threads freely.
//!
//! You can run this example by running the following command in a terminal
//!
//! ```
//! cargo run --example thread-info
//! ```
//!
//! Example output:
//!
//! ```not_rust
//! Jul 17 00:38:07.177 INFO ThreadId(02) thread_info: i=9
//! Jul 17 00:38:07.177 INFO thread 1 ThreadId(03) thread_info: i=9
//! Jul 17 00:38:07.177 INFO large name thread 2 ThreadId(04) thread_info: i=9
//! ```
#![deny(rust_2018_idioms)]
/// This is a example showing how thread info can be displayed when
/// formatting events with `tracing_subscriber::fmt`. This is useful
/// as `tracing` spans can be entered by multiple threads concurrently,
/// or move across threads freely.
///
/// You can run this example by running the following command in a terminal
///
/// ```
/// cargo run --example thread-info
/// ```
///
/// Example output:
///
/// ```not_rust
/// Jul 17 00:38:07.177 INFO ThreadId(02) thread_info: i=9
/// Jul 17 00:38:07.177 INFO thread 1 ThreadId(03) thread_info: i=9
/// Jul 17 00:38:07.177 INFO large name thread 2 ThreadId(04) thread_info: i=9
/// ```
use std::thread;
use std::time::Duration;
use tracing::info;
Expand Down
23 changes: 13 additions & 10 deletions examples/examples/toggle-subscribers.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This is a example showing how `Subscriber`s can be enabled or disabled by
//! by wrapping them with an `Option`. This example shows `fmt` and `json`
//! being toggled based on the `json` command line flag.
//!
//! You can run this example by running the following command in a terminal
//!
//! ```
//! cargo run --example toggle-subscribers -- --json
//! ```
//!
#![deny(rust_2018_idioms)]
/// This is a example showing how `Subscriber`s can be enabled or disabled by
/// by wrapping them with an `Option`. This example shows `fmt` and `json`
/// being toggled based on the `json` command line flag.
///
/// You can run this example by running the following command in a terminal
///
/// ```
/// cargo run --example toggle-subscribers -- --json
/// ```
///
use argh::FromArgs;
use tracing::info;
use tracing_subscriber::{subscribe::CollectExt, util::SubscriberInitExt};
Expand Down
19 changes: 11 additions & 8 deletions examples/examples/tokio-spawny-thing.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This is a example showing how information is scoped with tokio's
//! `task::spawn`.
//!
//! You can run this example by running the following command in a terminal
//!
//! ```
//! cargo run --example tokio-spawny-thing
//! ```
#![deny(rust_2018_idioms)]
/// This is a example showing how information is scoped with tokio's
/// `task::spawn`.
///
/// You can run this example by running the following command in a terminal
///
/// ```
/// cargo run --example tokio-spawny-thing
/// ```
use futures::future::try_join_all;
use tracing::{debug, info, instrument, span, Instrument as _, Level};

Expand Down
3 changes: 3 additions & 0 deletions examples/examples/tokio_panic_hook.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! This example demonstrates that a custom panic hook can be used to log panic
//! messages even when panics are captured (such as when a Tokio task panics).
//!
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/tower-client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
use http::{Method, Request, Uri};
use hyper::{client::Client, Body};
use std::time::Duration;
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/tower-load.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
//!
//! A demo showing how filtering on values and dynamic filter reloading can be
//! used together to help make sense of complex or noisy traces.
//!
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/tower-server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
//! release examples, please see the `v0.1.x` branch instead.
use futures::future;
use http::{Request, Response};
use hyper::{Body, Server};
Expand Down