Skip to content

Commit

Permalink
doc: use TracyLayer::default where no customization of config occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
nagisa committed Jan 6, 2024
1 parent 300b61d commit 9e3a43e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 2 additions & 6 deletions tracing-tracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
//! use tracing_subscriber::layer::SubscriberExt;
//!
//! tracing::subscriber::set_global_default(
//! tracing_subscriber::registry().with(
//! tracing_tracy::TracyLayer::new(tracing_tracy::DynamicConfig::new())
//! )
//! tracing_subscriber::registry().with(tracing_tracy::TracyLayer::default())
//! ).expect("setup tracy layer");
//! ```
//!
Expand Down Expand Up @@ -82,9 +80,7 @@ thread_local! {
/// ```rust
/// use tracing_subscriber::layer::SubscriberExt;
/// tracing::subscriber::set_global_default(
/// tracing_subscriber::registry().with(
/// tracing_tracy::TracyLayer::new(tracing_tracy::DynamicConfig::new())
/// )
/// tracing_subscriber::registry().with(tracing_tracy::TracyLayer::default())
/// ).expect("setup tracy layer");
/// ```
#[derive(Clone)]
Expand Down
5 changes: 3 additions & 2 deletions tracing-tracy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn span_with_fields() {

pub(crate) fn test() {
tracing::subscriber::set_global_default(
tracing_subscriber::registry().with(TracyLayer::new(DynamicConfig::new())),
tracing_subscriber::registry().with(TracyLayer::default()),
)
.expect("setup the subscriber");
it_works();
Expand Down Expand Up @@ -158,7 +158,8 @@ fn benchmark_message(c: &mut Criterion) {
});

c.bench_function("event/no_callstack", |bencher| {
let layer = tracing_subscriber::registry().with(TracyLayer::new(DynamicConfig::new().with_stack_depth(0)));
let layer = tracing_subscriber::registry()
.with(TracyLayer::new(DynamicConfig::new().with_stack_depth(0)));
tracing::subscriber::with_default(layer, || {
bencher.iter(|| {
tracing::error!(field1 = "first", field2 = "second", "message");
Expand Down

0 comments on commit 9e3a43e

Please sign in to comment.