Original code allows passing a custom message to write to the log file (outside of mapped exceptions). I'm not sure there is a way to accommodate this directly in sys.excepthook. Unless I'm missing something, we'd have to either keep handle_exception around (log message and rethrow), do an initial log everywhere that handle_exception is called.

thoughts?