summaryrefslogtreecommitdiffstats
path: root/vendor/tracing-log/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /vendor/tracing-log/src
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/tracing-log/src')
-rw-r--r--vendor/tracing-log/src/env_logger.rs49
-rw-r--r--vendor/tracing-log/src/interest_cache.rs16
-rw-r--r--vendor/tracing-log/src/lib.rs66
-rw-r--r--vendor/tracing-log/src/trace_logger.rs458
4 files changed, 25 insertions, 564 deletions
diff --git a/vendor/tracing-log/src/env_logger.rs b/vendor/tracing-log/src/env_logger.rs
deleted file mode 100644
index 74922d1dc..000000000
--- a/vendor/tracing-log/src/env_logger.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-//! Utilities for configuring the `env_logger` crate to emit `tracing` events.
-
-/// Extension trait to configure an `env_logger::Builder` to emit traces.
-pub trait BuilderExt: crate::sealed::Sealed {
- /// Configure the built `env_logger::Logger` to emit `tracing` events for
- /// all consumed `log` records, rather than printing them to standard out.
- ///
- /// Note that this replaces any previously configured formatting.
- fn emit_traces(&mut self) -> &mut Self;
-}
-
-impl crate::sealed::Sealed for env_logger::Builder {}
-
-impl BuilderExt for env_logger::Builder {
- fn emit_traces(&mut self) -> &mut Self {
- self.format(|_, record| super::format_trace(record))
- }
-}
-
-/// Attempts to initialize the global logger with an env logger configured to
-/// emit `tracing` events.
-///
-/// This should be called early in the execution of a Rust program. Any log
-/// events that occur before initialization will be ignored.
-///
-/// # Errors
-///
-/// This function will fail if it is called more than once, or if another
-/// library has already initialized a global logger.
-pub fn try_init() -> Result<(), log::SetLoggerError> {
- env_logger::Builder::from_default_env()
- .emit_traces()
- .try_init()
-}
-
-/// Initializes the global logger with an env logger configured to
-/// emit `tracing` events.
-///
-/// This should be called early in the execution of a Rust program. Any log
-/// events that occur before initialization will be ignored.
-///
-/// # Panics
-///
-/// This function will panic if it is called more than once, or if another
-/// library has already initialized a global logger.
-pub fn init() {
- try_init()
- .expect("tracing_log::env_logger::init should not be called after logger initialized");
-}
diff --git a/vendor/tracing-log/src/interest_cache.rs b/vendor/tracing-log/src/interest_cache.rs
index fb3da875e..aabf9ebaf 100644
--- a/vendor/tracing-log/src/interest_cache.rs
+++ b/vendor/tracing-log/src/interest_cache.rs
@@ -1,6 +1,7 @@
use ahash::AHasher;
use log::{Level, Metadata};
use lru::LruCache;
+use once_cell::sync::Lazy;
use std::cell::RefCell;
use std::hash::Hasher;
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -140,12 +141,10 @@ static SENTINEL_METADATA: tracing_core::Metadata<'static> = tracing_core::Metada
tracing_core::metadata::Kind::EVENT,
);
-lazy_static::lazy_static! {
- static ref CONFIG: Mutex<InterestCacheConfig> = {
- tracing_core::callsite::register(&SENTINEL_CALLSITE);
- Mutex::new(InterestCacheConfig::disabled())
- };
-}
+static CONFIG: Lazy<Mutex<InterestCacheConfig>> = Lazy::new(|| {
+ tracing_core::callsite::register(&SENTINEL_CALLSITE);
+ Mutex::new(InterestCacheConfig::disabled())
+});
thread_local! {
static STATE: RefCell<State> = {
@@ -236,10 +235,7 @@ mod tests {
fn lock_for_test() -> impl Drop {
// We need to make sure only one test runs at a time.
-
- lazy_static::lazy_static! {
- static ref LOCK: Mutex<()> = Mutex::new(());
- }
+ static LOCK: Lazy<Mutex<()>> = Lazy::new(Mutex::new);
match LOCK.lock() {
Ok(guard) => guard,
diff --git a/vendor/tracing-log/src/lib.rs b/vendor/tracing-log/src/lib.rs
index 09e9114a4..bb162d9e1 100644
--- a/vendor/tracing-log/src/lib.rs
+++ b/vendor/tracing-log/src/lib.rs
@@ -13,10 +13,8 @@
//! - [`AsTrace`] and [`AsLog`] traits for converting between `tracing` and `log` types.
//! - [`LogTracer`], a [`log::Log`] implementation that consumes [`log::Record`]s
//! and outputs them as [`tracing::Event`].
-//! - An [`env_logger`] module, with helpers for using the [`env_logger` crate]
-//! with `tracing` (optional, enabled by the `env-logger` feature).
//!
-//! *Compiler support: [requires `rustc` 1.49+][msrv]*
+//! *Compiler support: [requires `rustc` 1.56+][msrv]*
//!
//! [msrv]: #supported-rust-versions
//!
@@ -57,50 +55,45 @@
//!
//! ## Caution: Mixing both conversions
//!
-//! Note that logger implementations that convert log records to trace events
+//! Note that `log::Logger` implementations that convert log records to trace events
//! should not be used with `Subscriber`s that convert trace events _back_ into
-//! log records (such as the `TraceLogger`), as doing so will result in the
-//! event recursing between the subscriber and the logger forever (or, in real
-//! life, probably overflowing the call stack).
+//! `log` records, as doing so will result in the event recursing between the subscriber
+//! and the logger forever (or, in real life, probably overflowing the call stack).
//!
//! If the logging of trace events generated from log records produced by the
//! `log` crate is desired, either the `log` crate should not be used to
//! implement this logging, or an additional layer of filtering will be
//! required to avoid infinitely converting between `Event` and `log::Record`.
//!
-//! # Feature Flags
-//! * `trace-logger`: enables an experimental `log` subscriber, deprecated since
-//! version 0.1.1.
+//! ## Feature Flags
+//!
+//! * `std`: enables features that require the Rust standard library (on by default)
//! * `log-tracer`: enables the `LogTracer` type (on by default)
-//! * `env_logger`: enables the `env_logger` module, with helpers for working
-//! with the [`env_logger` crate].
//! * `interest-cache`: makes it possible to configure an interest cache for
//! logs emitted through the `log` crate (see [`Builder::with_interest_cache`]); requires `std`
//!
//! ## Supported Rust Versions
//!
//! Tracing is built against the latest stable release. The minimum supported
-//! version is 1.49. The current Tracing version is not guaranteed to build on
+//! version is 1.56. The current Tracing version is not guaranteed to build on
//! Rust versions earlier than the minimum supported version.
//!
//! Tracing follows the same compiler support policies as the rest of the Tokio
//! project. The current stable Rust compiler and the three most recent minor
//! versions before it will always be supported. For example, if the current
-//! stable compiler version is 1.45, the minimum supported version will not be
-//! increased past 1.42, three minor versions prior. Increasing the minimum
+//! stable compiler version is 1.69, the minimum supported version will not be
+//! increased past 1.66, three minor versions prior. Increasing the minimum
//! supported compiler version is not considered a semver breaking change as
//! long as doing so complies with this policy.
//!
//! [`init`]: LogTracer::init
//! [`init_with_filter`]: LogTracer::init_with_filter
//! [`tracing`]: https://crates.io/crates/tracing
-//! [`env_logger` crate]: https://crates.io/crates/env-logger
//! [`tracing::Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
//! [`tracing::Event`]: https://docs.rs/tracing/latest/tracing/struct.Event.html
//! [flags]: https://docs.rs/tracing/latest/tracing/#crate-feature-flags
//! [`Builder::with_interest_cache`]: log_tracer::Builder::with_interest_cache
-#![doc(html_root_url = "https://docs.rs/tracing-log/0.1.3")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
@@ -112,7 +105,6 @@
rust_2018_idioms,
unreachable_pub,
bad_style,
- const_err,
dead_code,
improper_ctypes,
non_shorthand_field_patterns,
@@ -128,7 +120,7 @@
unused_parens,
while_true
)]
-use lazy_static::lazy_static;
+use once_cell::sync::Lazy;
use std::{fmt, io};
@@ -145,29 +137,11 @@ use tracing_core::{
#[cfg_attr(docsrs, doc(cfg(feature = "log-tracer")))]
pub mod log_tracer;
-#[cfg(feature = "trace-logger")]
-#[cfg_attr(docsrs, doc(cfg(feature = "trace-logger")))]
-pub mod trace_logger;
-
#[cfg(feature = "log-tracer")]
#[cfg_attr(docsrs, doc(cfg(feature = "log-tracer")))]
#[doc(inline)]
pub use self::log_tracer::LogTracer;
-#[cfg(feature = "trace-logger")]
-#[cfg_attr(docsrs, doc(cfg(feature = "trace-logger")))]
-#[deprecated(
- since = "0.1.1",
- note = "use the `tracing` crate's \"log\" feature flag instead"
-)]
-#[allow(deprecated)]
-#[doc(inline)]
-pub use self::trace_logger::TraceLogger;
-
-#[cfg(feature = "env_logger")]
-#[cfg_attr(docsrs, doc(cfg(feature = "env_logger")))]
-pub mod env_logger;
-
pub use log;
#[cfg(all(feature = "interest-cache", feature = "log-tracer", feature = "std"))]
@@ -309,9 +283,9 @@ macro_rules! log_cs {
"log event",
"log",
$level,
- None,
- None,
- None,
+ ::core::option::Option::None,
+ ::core::option::Option::None,
+ ::core::option::Option::None,
field::FieldSet::new(FIELD_NAMES, identify_callsite!(&$cs)),
Kind::EVENT,
);
@@ -346,13 +320,11 @@ log_cs!(
ErrorCallsite
);
-lazy_static! {
- static ref TRACE_FIELDS: Fields = Fields::new(&TRACE_CS);
- static ref DEBUG_FIELDS: Fields = Fields::new(&DEBUG_CS);
- static ref INFO_FIELDS: Fields = Fields::new(&INFO_CS);
- static ref WARN_FIELDS: Fields = Fields::new(&WARN_CS);
- static ref ERROR_FIELDS: Fields = Fields::new(&ERROR_CS);
-}
+static TRACE_FIELDS: Lazy<Fields> = Lazy::new(|| Fields::new(&TRACE_CS));
+static DEBUG_FIELDS: Lazy<Fields> = Lazy::new(|| Fields::new(&DEBUG_CS));
+static INFO_FIELDS: Lazy<Fields> = Lazy::new(|| Fields::new(&INFO_CS));
+static WARN_FIELDS: Lazy<Fields> = Lazy::new(|| Fields::new(&WARN_CS));
+static ERROR_FIELDS: Lazy<Fields> = Lazy::new(|| Fields::new(&ERROR_CS));
fn level_to_cs(level: Level) -> (&'static dyn Callsite, &'static Fields) {
match level {
diff --git a/vendor/tracing-log/src/trace_logger.rs b/vendor/tracing-log/src/trace_logger.rs
deleted file mode 100644
index 88a52f752..000000000
--- a/vendor/tracing-log/src/trace_logger.rs
+++ /dev/null
@@ -1,458 +0,0 @@
-//! A `tracing` [`Subscriber`] that uses the [`log`] crate as a backend for
-//! formatting `tracing` spans and events.
-//!
-//! When a [`TraceLogger`] is set as the current subscriber, it will record
-//! traces by emitting [`log::Record`]s that can be collected by a logger.
-//!
-//! **Note**: This API has been deprecated since version 0.1.1. In order to emit
-//! `tracing` events as `log` records, the ["log" and "log-always" feature
-//! flags][flags] on the `tracing` crate should be used instead.
-//!
-//! [`log`]: log
-//! [`Subscriber`]: https://docs.rs/tracing/0.1.7/tracing/subscriber/trait.Subscriber.html
-//! [`log::Record`]:log::Record
-//! [flags]: https://docs.rs/tracing/latest/tracing/#crate-feature-flags
-#![deprecated(
- since = "0.1.1",
- note = "use the `tracing` crate's \"log\" feature flag instead"
-)]
-use crate::AsLog;
-use std::{
- cell::RefCell,
- collections::HashMap,
- fmt::{self, Write},
- sync::{
- atomic::{AtomicUsize, Ordering},
- Mutex,
- },
-};
-use tracing_core::{
- field,
- span::{self, Id},
- Event, Metadata, Subscriber,
-};
-
-/// A `tracing` [`Subscriber`] implementation that logs all recorded
-/// trace events.
-///
-/// **Note**: This API has been deprecated since version 0.1.1. In order to emit
-/// `tracing` events as `log` records, the ["log" and "log-always" feature
-/// flags][flags] on the `tracing` crate should be used instead.
-///
-/// [`Subscriber`]: https://docs.rs/tracing/0.1.7/tracing/subscriber/trait.Subscriber.html
-/// [flags]: https://docs.rs/tracing/latest/tracing/#crate-feature-flags
-pub struct TraceLogger {
- settings: Builder,
- spans: Mutex<HashMap<Id, SpanLineBuilder>>,
- next_id: AtomicUsize,
-}
-
-thread_local! {
- static CURRENT: RefCell<Vec<Id>> = RefCell::new(Vec::new());
-}
-/// Configures and constructs a [`TraceLogger`].
-///
-#[derive(Debug)]
-pub struct Builder {
- log_span_closes: bool,
- log_enters: bool,
- log_exits: bool,
- log_ids: bool,
- parent_fields: bool,
- log_parent: bool,
-}
-
-// ===== impl TraceLogger =====
-
-impl TraceLogger {
- /// Returns a new `TraceLogger` with the default configuration.
- pub fn new() -> Self {
- Self::builder().finish()
- }
-
- /// Returns a `Builder` for configuring a `TraceLogger`.
- pub fn builder() -> Builder {
- Default::default()
- }
-
- fn from_builder(settings: Builder) -> Self {
- Self {
- settings,
- ..Default::default()
- }
- }
-
- fn next_id(&self) -> Id {
- Id::from_u64(self.next_id.fetch_add(1, Ordering::SeqCst) as u64)
- }
-}
-
-// ===== impl Builder =====
-
-impl Builder {
- /// Configures whether or not the [`TraceLogger`] being constructed will log
- /// when a span closes.
- ///
- pub fn with_span_closes(self, log_span_closes: bool) -> Self {
- Self {
- log_span_closes,
- ..self
- }
- }
-
- /// Configures whether or not the [`TraceLogger`] being constructed will
- /// include the fields of parent spans when formatting events.
- ///
- pub fn with_parent_fields(self, parent_fields: bool) -> Self {
- Self {
- parent_fields,
- ..self
- }
- }
-
- /// Configures whether or not the [`TraceLogger`] being constructed will log
- /// when a span is entered.
- ///
- /// If this is set to false, fields from the current span will still be
- /// recorded as context, but the actual entry will not create a log record.
- ///
- pub fn with_span_entry(self, log_enters: bool) -> Self {
- Self { log_enters, ..self }
- }
-
- /// Configures whether or not the [`TraceLogger`] being constructed will log
- /// when a span is exited.
- ///
- pub fn with_span_exits(self, log_exits: bool) -> Self {
- Self { log_exits, ..self }
- }
-
- /// Configures whether or not the [`TraceLogger`] being constructed will
- /// include span IDs when formatting log output.
- ///
- pub fn with_ids(self, log_ids: bool) -> Self {
- Self { log_ids, ..self }
- }
-
- /// Configures whether or not the [`TraceLogger`] being constructed will
- /// include the names of parent spans as context when formatting events.
- ///
- pub fn with_parent_names(self, log_parent: bool) -> Self {
- Self { log_parent, ..self }
- }
-
- /// Complete the builder, returning a configured [`TraceLogger`].
- ///
- pub fn finish(self) -> TraceLogger {
- TraceLogger::from_builder(self)
- }
-}
-
-impl Default for Builder {
- fn default() -> Self {
- Builder {
- log_span_closes: false,
- parent_fields: true,
- log_exits: false,
- log_ids: false,
- log_parent: true,
- log_enters: false,
- }
- }
-}
-
-impl Default for TraceLogger {
- fn default() -> Self {
- TraceLogger {
- settings: Default::default(),
- spans: Default::default(),
- next_id: AtomicUsize::new(1),
- }
- }
-}
-
-#[derive(Debug)]
-struct SpanLineBuilder {
- parent: Option<Id>,
- ref_count: usize,
- fields: String,
- file: Option<String>,
- line: Option<u32>,
- module_path: Option<String>,
- target: String,
- level: log::Level,
- name: &'static str,
-}
-
-impl SpanLineBuilder {
- fn new(parent: Option<Id>, meta: &Metadata<'_>, fields: String) -> Self {
- Self {
- parent,
- ref_count: 1,
- fields,
- file: meta.file().map(String::from),
- line: meta.line(),
- module_path: meta.module_path().map(String::from),
- target: String::from(meta.target()),
- level: meta.level().as_log(),
- name: meta.name(),
- }
- }
-
- fn log_meta(&self) -> log::Metadata<'_> {
- log::MetadataBuilder::new()
- .level(self.level)
- .target(self.target.as_ref())
- .build()
- }
-
- fn finish(self) {
- let log_meta = self.log_meta();
- let logger = log::logger();
- if logger.enabled(&log_meta) {
- logger.log(
- &log::Record::builder()
- .metadata(log_meta)
- .target(self.target.as_ref())
- .module_path(self.module_path.as_ref().map(String::as_ref))
- .file(self.file.as_ref().map(String::as_ref))
- .line(self.line)
- .args(format_args!("close {}; {}", self.name, self.fields))
- .build(),
- );
- }
- }
-}
-
-impl field::Visit for SpanLineBuilder {
- fn record_debug(&mut self, field: &field::Field, value: &dyn fmt::Debug) {
- write!(self.fields, " {}={:?};", field.name(), value)
- .expect("write to string should never fail")
- }
-}
-
-impl Subscriber for TraceLogger {
- fn enabled(&self, metadata: &Metadata<'_>) -> bool {
- log::logger().enabled(&metadata.as_log())
- }
-
- fn new_span(&self, attrs: &span::Attributes<'_>) -> Id {
- let id = self.next_id();
- let mut spans = self.spans.lock().unwrap();
- let mut fields = String::new();
- let parent = self.current_id();
- if self.settings.parent_fields {
- let mut next_parent = parent.as_ref();
- while let Some(parent) = next_parent.and_then(|p| spans.get(p)) {
- write!(&mut fields, "{}", parent.fields).expect("write to string cannot fail");
- next_parent = parent.parent.as_ref();
- }
- }
- let mut span = SpanLineBuilder::new(parent, attrs.metadata(), fields);
- attrs.record(&mut span);
- spans.insert(id.clone(), span);
- id
- }
-
- fn record(&self, span: &Id, values: &span::Record<'_>) {
- let mut spans = self.spans.lock().unwrap();
- if let Some(span) = spans.get_mut(span) {
- values.record(span);
- }
- }
-
- fn record_follows_from(&self, span: &Id, follows: &Id) {
- // TODO: this should eventually track the relationship?
- log::logger().log(
- &log::Record::builder()
- .level(log::Level::Trace)
- .args(format_args!("span {:?} follows_from={:?};", span, follows))
- .build(),
- );
- }
-
- fn enter(&self, id: &Id) {
- let _ = CURRENT.try_with(|current| {
- let mut current = current.borrow_mut();
- if current.contains(id) {
- // Ignore duplicate enters.
- return;
- }
- current.push(id.clone());
- });
- let spans = self.spans.lock().unwrap();
- if self.settings.log_enters {
- if let Some(span) = spans.get(id) {
- let log_meta = span.log_meta();
- let logger = log::logger();
- if logger.enabled(&log_meta) {
- let current_id = self.current_id();
- let current_fields = current_id
- .as_ref()
- .and_then(|id| spans.get(id))
- .map(|span| span.fields.as_ref())
- .unwrap_or("");
- if self.settings.log_ids {
- logger.log(
- &log::Record::builder()
- .metadata(log_meta)
- .target(span.target.as_ref())
- .module_path(span.module_path.as_ref().map(String::as_ref))
- .file(span.file.as_ref().map(String::as_ref))
- .line(span.line)
- .args(format_args!(
- "enter {}; in={:?}; {}",
- span.name, current_id, current_fields
- ))
- .build(),
- );
- } else {
- logger.log(
- &log::Record::builder()
- .metadata(log_meta)
- .target(span.target.as_ref())
- .module_path(span.module_path.as_ref().map(String::as_ref))
- .file(span.file.as_ref().map(String::as_ref))
- .line(span.line)
- .args(format_args!("enter {}; {}", span.name, current_fields))
- .build(),
- );
- }
- }
- }
- }
- }
-
- fn exit(&self, id: &Id) {
- let _ = CURRENT.try_with(|current| {
- let mut current = current.borrow_mut();
- if current.last() == Some(id) {
- current.pop()
- } else {
- None
- }
- });
- if self.settings.log_exits {
- let spans = self.spans.lock().unwrap();
- if let Some(span) = spans.get(id) {
- let log_meta = span.log_meta();
- let logger = log::logger();
- if logger.enabled(&log_meta) {
- logger.log(
- &log::Record::builder()
- .metadata(log_meta)
- .target(span.target.as_ref())
- .module_path(span.module_path.as_ref().map(String::as_ref))
- .file(span.file.as_ref().map(String::as_ref))
- .line(span.line)
- .args(format_args!("exit {}", span.name))
- .build(),
- );
- }
- }
- }
- }
-
- fn event(&self, event: &Event<'_>) {
- let meta = event.metadata();
- let log_meta = meta.as_log();
- let logger = log::logger();
- if logger.enabled(&log_meta) {
- let spans = self.spans.lock().unwrap();
- let current = self.current_id().and_then(|id| spans.get(&id));
- let (current_fields, parent) = current
- .map(|span| {
- let fields = span.fields.as_ref();
- let parent = if self.settings.log_parent {
- Some(span.name)
- } else {
- None
- };
- (fields, parent)
- })
- .unwrap_or(("", None));
- logger.log(
- &log::Record::builder()
- .metadata(log_meta)
- .target(meta.target())
- .module_path(meta.module_path().as_ref().cloned())
- .file(meta.file().as_ref().cloned())
- .line(meta.line())
- .args(format_args!(
- "{}{}{}{}",
- parent.unwrap_or(""),
- if parent.is_some() { ": " } else { "" },
- LogEvent(event),
- current_fields,
- ))
- .build(),
- );
- }
- }
-
- fn clone_span(&self, id: &Id) -> Id {
- let mut spans = self.spans.lock().unwrap();
- if let Some(span) = spans.get_mut(id) {
- span.ref_count += 1;
- }
- id.clone()
- }
-
- fn try_close(&self, id: Id) -> bool {
- let mut spans = self.spans.lock().unwrap();
- if spans.contains_key(&id) {
- if spans.get(&id).unwrap().ref_count == 1 {
- let span = spans.remove(&id).unwrap();
- if self.settings.log_span_closes {
- span.finish();
- }
- return true;
- } else {
- spans.get_mut(&id).unwrap().ref_count -= 1;
- }
- }
- false
- }
-}
-
-impl TraceLogger {
- #[inline]
- fn current_id(&self) -> Option<Id> {
- CURRENT
- .try_with(|current| current.borrow().last().map(|span| self.clone_span(span)))
- .ok()?
- }
-}
-
-struct LogEvent<'a>(&'a Event<'a>);
-
-impl<'a> fmt::Display for LogEvent<'a> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- let mut has_logged = false;
- let mut format_fields = |field: &field::Field, value: &dyn fmt::Debug| {
- let name = field.name();
- let leading = if has_logged { " " } else { "" };
- // TODO: handle fmt error?
- let _ = if name == "message" {
- write!(f, "{}{:?};", leading, value)
- } else {
- write!(f, "{}{}={:?};", leading, name, value)
- };
- has_logged = true;
- };
-
- self.0.record(&mut format_fields);
- Ok(())
- }
-}
-
-impl fmt::Debug for TraceLogger {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("TraceLogger")
- .field("settings", &self.settings)
- .field("spans", &self.spans)
- .field("current", &self.current_id())
- .field("next_id", &self.next_id)
- .finish()
- }
-}