diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2024-08-08 09:43:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-08 09:43:36 -0400 |
| commit | 47ad76f513846a8501f84c057b28a146031859b6 (patch) | |
| tree | 0d29cb0f87473f925c07f9b58949357ae1cf141d /lib/debug/debug.py | |
| parent | 17b88ce2c14a0802e18e90d8dd142224013dfb15 (diff) | |
Show page in simulator (#3120)
* add exception logging helpers
* wip
* show page and drop shadow from SVG
* allow toggling page
* add page icon
* add dark mode icon
* showpageshadow
* refresh after background change (fix for macOS)
* fix params sim background
* try a native GraphicsBrush for windows
* show page button in standalone simulator only and adapt shadow color
* remove doubled line
---------
Co-authored-by: Kaalleen <reni@allenka.de>
Diffstat (limited to 'lib/debug/debug.py')
| -rw-r--r-- | lib/debug/debug.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/debug/debug.py b/lib/debug/debug.py index ab5132e4..d96dd36d 100644 --- a/lib/debug/debug.py +++ b/lib/debug/debug.py @@ -5,6 +5,7 @@ import atexit # to save svg file on exit import time # to measure time of code block, use time.monotonic() instead of time.time() +import traceback from datetime import datetime from contextlib import contextmanager # to measure time of with block @@ -246,6 +247,18 @@ class Debug(object): if self.enabled: self.raw_log("completed %s, duration = %s", label, time.monotonic() - start) + def log_exception(self): + if self.enabled: + self.raw_log(traceback.format_exc()) + + @contextmanager + def log_exceptions(self): + try: + yield + except Exception: + self.log_exception() + raise + # global debug object debug = Debug() |
