parasyte / cartunes

Simple comparison app for iRacing car setups.
MIT License
56 stars 12 forks source link

Send logs to Windows Event Viewer #34

Open parasyte opened 1 year ago

parasyte commented 1 year ago

I got a report on Reddit that said the app would not work, and it led to a discussion involving how to troubleshoot the issue. One of the challenges with the Windows build is that all standard output is disabled so the app doesn't require a separate console window. This improves UX in the general case (i.e., when things work) but is really bad for troubleshooting because error messages are not visible anywhere.

One thing I have done in another project for error reporting on Windows is using the msgbox crate to open a simple message box window when there are any fatal errors. The UX is ok-ish; you are given some info about the problem, but the only thing you can do with it is take a screenshot. If the error is long enough, it may not fit on the screen at all! There is no scroll bar and no way to copy the text.

I propose that fatal errors should use msgbox to bring attention to the problem in a minimalistic way. Instead of printing the entire error message in the message box, it should provide a short description of the error and instruct the user to look in the Windows Event Viewer (if the platform is Windows) for any additional context. The win_etw_logger crate provides a Log implementation just for this purpose! It can spew everything with level WARN and above to the Event Tracing for Windows thingie.

That should provide a pretty good UX when things go bad (how good can it be, honestly, when the app won't even start?) At least it will be a marked improvement.