Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Right now, there is no way to indicate that a span field _currently_ has no value but that a value will be recorded later. Tracing used to support this concept, but when we added local-variable shorthand, it was removed from the macros, as we needed to use the previous syntax for indicating empty fields for local variable shorthand. See #77 for details. This commit side-steps the problem of determining an appropriate _syntax_ for empty fields by adding a special value _type_, called `Empty`. Now, empty values can be indicated like ```rust span!("my_span", foo = 5, bar = tracing::field::Empty); ``` The `Empty` type implements `Value`, but its' `record` method is a no-op that doesn't' call any functions on the visitor. Therefore, when a field is empty, the visitor will not see it. An empty field can then be recorded later using `Subscriber::record` (or the corresponding `Span` method in `tracing`). Signed-off-by: Eliza Weisman <eliza@buoyant.io>
- Loading branch information