Add uncaught exception handler to flush log to file
Add uncaught exception handler in case of a crash, to flush persistent logging if enabled
@kewisch On further review I don't think this is actually necessary for the Sync Debug epic. Because we are writing to an internal file instead of to the debug log the file contents are preserved even through a crash. Now, if we think there is an issue with syncing that might crash the app but not be caught by the current sync tooling this may be helpful but I'm not sure thats an expected use case
Is there some sort of I/O buffer that would be lost of a crash occurs? I think we should prepare for the fact that there may be future cases where a crash occurs with syncing, and I suspect this type of debug tooling will be useful not only for sync type crashes.
I will check if the BufferedWriter needs to be flushed