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
Add support for RUST_LIB_BACKTRACE variable #38
Conversation
If I understand the distinction between If my assumptions above are correct, shouldn't we somehow mirror this by having two distinct verbosity levels -- one for when used as a panic handler and one for printing user provided backtraces? |
Yes we should, I'll fix that |
Hmm, it seems like there are a few options here for how to move forward but I'm not really sure which one you'd prefer. The main issue is the
Additionally, I didn't notice before but you already added the ability to override the verbosity, so technically this issue isn't really required, I can get the correct verbosity level set in my crate even without merging this, so I guess the 3rd option is just to close this, though I do think it would be idea to provide some level of |
I'd say we go with the first option. We'll also need a second |
I'm gonna pass on bikeshedding internal API names, lib_from_env sounds great to me, lol |
Hahaha, alright, |
Ok(ref x) if x == "full" => Verbosity::Full, | ||
Ok(_) => Verbosity::Medium, | ||
Err(_) => Verbosity::Minimal, | ||
Self::convert_env(env::var("RUST_BACKTRACE").ok()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these methods follow std's example and make some effort to cache these values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I think this is fine as-is. I'd argue that panic printers and thus verbosity instances are generally constructed only few times per app-run and it wouldn't be worth the effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, excellent PR!
Ok(ref x) if x == "full" => Verbosity::Full, | ||
Ok(_) => Verbosity::Medium, | ||
Err(_) => Verbosity::Minimal, | ||
Self::convert_env(env::var("RUST_BACKTRACE").ok()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I think this is fine as-is. I'd argue that panic printers and thus verbosity instances are generally constructed only few times per app-run and it wouldn't be worth the effort.
Loosely based on this part of std
https://doc.rust-lang.org/stable/src/std/backtrace.rs.html#228-247
closes #30