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

tracing: backport "implement enabled!" #1883

Merged
merged 4 commits into from
Feb 2, 2022

Commits on Feb 1, 2022

  1. tracing: add enabled! macro (tokio-rs#1821)

    ## 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 
    
    Also, my project is on the crates.io version, so this would need to be
    backported to 0.1, I can help with that with guidance.
    
    Co-authored-by: Eliza Weisman <eliza@buoyant.io>
    Co-authored-by: David Barsky <me@davidbarsky.com>
    3 people committed Feb 1, 2022
    Configuration menu
    Copy the full SHA
    27f4b9f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aa1278a View commit details
    Browse the repository at this point in the history
  3. fix doc links

    guswynn committed Feb 1, 2022
    Configuration menu
    Copy the full SHA
    27da31b View commit details
    Browse the repository at this point in the history
  4. fix tests and more links

    guswynn committed Feb 1, 2022
    Configuration menu
    Copy the full SHA
    f2c90b6 View commit details
    Browse the repository at this point in the history