rust-cli / human-panic

Panic messages for humans.
https://docs.rs/human-panic
Apache License 2.0
1.66k stars 65 forks source link

Where is the panic! log message ? #55

Open Riduidel opened 5 years ago

Riduidel commented 5 years ago

🔦 question?

Expected Behavior

When using panic!, the log message is displayed prior to the stack trace. As an example, this statement

panic!("feed item {:?} can't be parsed, as it doesn't have pub_date", &self);

will display an error message in stdout prior to the stack trace.

Current Behavior

The generated log file contains lots of info, but not this log message

Possible Solution

How could I add the log message to that file ?

Context

I'm using human_panic in a command-line app I'm developing

Code Sample

Your Environment

name = 'rrss2imap' operating_system = 'windows' crate_version = '0.1.3-alpha.0'

(I'm quite sure this section could be automatically generated when using human_panic)

samuela commented 5 years ago

Same here... I don't really understand how this was ignored, or if I'm severely misunderstanding something...

naturallymitchell commented 5 years ago

In our project we reimplemented human-panic internally, so you could copy it in the meantime.

I'd really like some review of the code and to collaborate within this issue queue, since there still must be potential improvements available to this snippet, https://github.com/foundpatterns/torchbear/commit/83423689d2b9e39dbd0cdc841399e9d769f23f65.

I think what you're looking for would be in create_hook(), but it'd need to be added to the Error, in addition to the RUST_BACKTRACE.

Profpatsch commented 4 years ago

Huh, noticed this just now when the first error report from a user came in.

https://github.com/rust-cli/human-panic/blob/70db948973a746418e3a23434fe48fe45d3c9866/src/lib.rs#L202-L210

It’s kind of useless for us without the most important bit (the error message!)

The RFC has been closed since 2017, but the feature is still marked unstable rust only, which appears to be an oversight?

curiousleo commented 4 years ago

The RFC has been closed since 2017, but the feature is still marked unstable rust only, which appears to be an oversight?

The tracking issue has just been corrected in this PR: https://github.com/rust-lang/rust/pull/66771/files#diff-23e04906de6f359a78328a93305eca79R95

The correct tracking issue for the stabilisation of PanicInfo::message is https://github.com/rust-lang/rust/issues/66745.