Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting event names in macros. #2699

Merged
merged 8 commits into from Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions tracing/src/lib.rs
Expand Up @@ -214,7 +214,7 @@
//! ### Configuring Attributes
//!
//! Both macros require a [`Level`] specifying the verbosity of the span or
//! event. Optionally, the [target] and [parent span] may be overridden. If the
//! event. Optionally, the name, [target] and [parent span] may be overridden. If the
twitchax marked this conversation as resolved.
Show resolved Hide resolved
//! target and parent span are not overridden, they will default to the
//! module path where the macro was invoked and the current span (as determined
//! by the collector), respectively.
Expand All @@ -237,7 +237,16 @@
//! ```
//!
//! The span macros also take a string literal after the level, to set the name
//! of the span.
//! of the span (as above). In the case of the event macros, the name of the event can
//! be overridden (the default is `event file:line`) using the `name:` specifier.
//!
twitchax marked this conversation as resolved.
Show resolved Hide resolved
//! ```
//! # use tracing::{span, event, Level};
//! # fn main() {
//! span!(Level::TRACE, "my span");
//! event!(name: "some_info", Level::INFO, "something has happened!");
//! # }
//! ```
//!
//! ### Recording Fields
//!
Expand Down