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

Shall there be a cfg feature that removes all the overhead and features? #35

Open
vi opened this issue Jan 26, 2024 · 2 comments
Open

Comments

@vi
Copy link

vi commented Jan 26, 2024

Shall there be some compile-time knob that renders all async_backtrace::framed annotations no-ops? (and makes backtrace and other functions return dummy values).

Something like log's or tracing's max_level_off / release_max_level_off.

@jswrenn
Copy link
Collaborator

jswrenn commented Feb 19, 2024

That sounds like a great idea! I'll look into it.

@amunra
Copy link

amunra commented Dec 19, 2024

Would be useful.
My current workaround is:

#[cfg_attr(debug_assertions, async_backtrace::framed)]
async fn foo(...) { ... }

and

macro_rules! traced {
    ($e:expr) => {{
        #[cfg(debug_assertions)]
        {
            async_backtrace::location!().frame($e)
        }

        #[cfg(not(debug_assertions))]
        {
            $e
        }
    }};
}
runtime.block_on(traced!(async {
    ....
}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants