Skip to content
Open
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: 1 addition & 1 deletion tracing-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ mod expand;
/// to the generated span through the `fields` argument on the
/// `#[instrument]` macro. Strings, integers or boolean literals are accepted values
/// for each field. The name of the field must be a single valid Rust
/// identifier, nested (dotted) field names are not supported. Any
/// identifier, though nested (dotted) field names are supported. Any
/// Rust expression can be used as a field value in this manner. These
/// expressions will be evaluated at the beginning of the function's body, so
/// arguments to the function may be used in these expressions. Field names may
Expand Down
4 changes: 3 additions & 1 deletion tracing-attributes/tests/instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn override_everything() {

#[test]
fn fields() {
#[instrument(target = "my_target", level = "debug")]
#[instrument(target = "my_target", level = "debug", fields(nested.dotted.field = "foo-bar"))]
fn my_fn(arg1: usize, arg2: bool, arg3: String) {}

let span = expect::span()
Expand All @@ -70,6 +70,7 @@ fn fields() {
.with_value(&2usize)
.and(expect::field("arg2").with_value(&false))
.and(expect::field("arg3").with_value(&"Cool".to_string()))
.and(expect::field("nested.dotted.field").with_value(&"foo-bar"))
.only(),
),
)
Expand All @@ -82,6 +83,7 @@ fn fields() {
.with_value(&3usize)
.and(expect::field("arg2").with_value(&true))
.and(expect::field("arg3").with_value(&"Still Cool".to_string()))
.and(expect::field("nested.dotted.field").with_value(&"foo-bar"))
.only(),
),
)
Expand Down