Skip to content

How to get the values in current span? #2629

Answered by tisonkun
tisonkun asked this question in Q&A
Discussion options

You must be logged in to vote

@davidbarsky I found that it's actually the nested spans capture key values already. I write my own fatal like:

#[macro_export]
macro_rules! fatal {
    ($($arg:tt)*) => {{
        let prev = std::panic::take_hook();
        std::panic::set_hook(Box::new(move |info| {
            tracing::error!("{info}");
            prev(info);
        }));
        panic!($($arg)*);
    }};
}

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
8 replies
@tisonkun
Comment options

@tisonkun
Comment options

@davidbarsky
Comment options

@tisonkun
Comment options

@davidbarsky
Comment options

Comment options

You must be logged in to vote
2 replies
@tisonkun
Comment options

@davidbarsky
Comment options

Answer selected by tisonkun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants