Commit a367813
tracing: add
Backports tokio-rs#1821 to `v0.1.x`.
## Motivation
Closes: tokio-rs#1668
My usecase is different than the referenced "avoid doing something
expensive to log": I want to guard turning on `debug` mode for an ffi'd
library, based on some `target` that represents the "module" we care
about.
## Solution
The macro is very similar to `event!`, but adds a few simplistic cases,
and generates ever so slightly different code (to return the correct
value always. It also skips anything to do with `tracing-log`. I
considered (and tried), to share the impl between `event!` and
`enabled!`, but must confess I am not good at macros and got stuck. I
think they are sufficiently different, where copied impls, is easier to
read. We already manage
Co-authored-by: Eliza Weisman <[email protected]>
Co-authored-by: David Barsky <[email protected]>enabled! macro (tokio-rs#1883)1 parent 17c6502 commit a367813
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
385 | 390 | | |
386 | 391 | | |
387 | 392 | | |
| |||
495 | 500 | | |
496 | 501 | | |
497 | 502 | | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
498 | 508 | | |
499 | 509 | | |
500 | 510 | | |
| |||
0 commit comments