[meld] Set up exception logging on Windows



commit 489d09851278b9347de3d90b14e4716924e0206b
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jan 11 07:17:52 2020 +1000

    Set up exception logging on Windows
    
    We added file logging on Windows in 28102e3c, but that didn't include
    actually getting exceptions. This commit adds the simplest possible
    exception hook so that we get exceptions also being logged to the new
    log file.

 bin/meld | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/bin/meld b/bin/meld
index 786e5a34..e193367d 100755
--- a/bin/meld
+++ b/bin/meld
@@ -336,6 +336,13 @@ def setup_logging():
         log_path = os.path.join(GLib.get_user_data_dir(), "meld.log")
         handler = logging.FileHandler(log_path)
         log.setLevel(logging.INFO)
+
+        # Set excepthook so that we get exceptions on Windows
+        def logging_except_hook(exc_type, exc_instance, tb):
+            log.error(
+                'Unhandled exception', exc_info=(exc_type, exc_instance, tb))
+
+        sys.excepthook = logging_except_hook
     else:
         handler = logging.StreamHandler()
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]