Cfg_attr with attr that manipulates another attr

I a bit stuck on how to achieve this pseudo code:

#[cfg_attr(feature = "mine", my_instrument!("trace"))]
fn something() {
   println!("please")    
}
#[macro_export]
macro_rules! my_instrument {
    ($lvl:expr) => {
        instrument( level =$(lvl) )
}

I'm wanting to apply the instrument attribute macro after 'configuring' it.
I'd appreciate pointers towards the best/most appropriate way to do this.

As best I can tell procedural attribute macros allow you to manipulate the function they are attached to.
Here I want to manipulate the attribute macro then attach that to the function.

Decl macros (macro_rules!) can't be used as attribute macros. Only proc macros can.

1 Like