Send logs to Windows Event Viewer
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.
I confused Event Viewer with Event Tracing for Windows. These are very different things.
- For Event Viewer: A combination of log-panics and eventlog. (Requires admin privileges to register the event source, e.g. during application installation.)
- For ETW: A combination of tracing-panic and tracing-etw. (Requires starting a tracing session with external tools.)
ETW is designed for sysadmins to dynamically control how much detail they want logged (event tracing) while troubleshooting an application in production. It isn't enabled by default and is not expected that users should manually configure it in order to troubleshoot your application.
On the other hand, the Windows Event Log is for general purpose error reporting and application logging, just exactly what we need.