Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trace: Switch to using
local_inner_macros
for instrumentation API (#…
…969) ## Motivation Currently, it isn't possible to import individual macros from `tokio-trace` using the macros 1.2 syntax: ```rust use tokio_trace::{debug, info, span}; ``` This is because these macros require that `callsite` and `enabled` are imported as well. ## Solution This branch resolves the problem by adding the [`local_inner_macros`] attribute to the instrumentation API's macros. This allows other macros from within the crate to be used without requiring them to be explicitly imported. However, this also requires duplicating any macros from other sources (such as std and `tokio-trace-core`) with wrappers due to the behaviour of `local_inner_macros`. I've added these wrapper macros as well. Since the macros got even longer as a result of this, I've moved them to a separate file to make `lib.rs` easier to read. I've also wrapped some very long lines in the macros, and removed the explicit drop of the result of evaluating some event macros (it's no longer necessary as all event macros now evaluate to `()`). [`local_inner_macros`]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/macros/macro-changes.html#local-helper-macros Fixes #968 Signed-off-by: Eliza Weisman <[email protected]>
- Loading branch information