tracing icon indicating copy to clipboard operation
tracing copied to clipboard

Trace events on panic

Open Kubikx opened this issue 5 years ago • 2 comments

Trace events on panic

Motivation

I write dynamicaly linked library that encounters panic caused by multiple things (like mistakes or invalid data coming from outside of crate). stacktrace appear only in console window (if shows), and log contains no information about it. Right now people needs to copy paste the console window before it close to be able to provide useful bug report. It would be great if the stacktrace would be in the file with rest of the log.

Proposal

Emit tracing even with maximum severity when panic happen.

Only thing that I am aware of that could be a problem for you is case when the panic will be caused by tracing itself. I think it will then probably crash with stack owerflow or something. I have no idea how that can be prevented, but on the other hand it should not be a common issue.

Alternatives

Each user would register own global panic handler, and emit tracing event manually. That does not sound as bad idea either, but I tried and it did not end in the file, so example how to do it correctly would be appreciated.

Kubikx avatar Feb 14 '20 05:02 Kubikx