summaryrefslogtreecommitdiff
path: root/lib/debug
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-07-18 18:59:00 +0200
committerGitHub <noreply@github.com>2024-07-18 18:59:00 +0200
commitc089a5ed0c00b7c0b6ac1c82ba1c21ed9f50c68e (patch)
tree1a4bc98d9e92e77ad129c3d3f5e73b4073b069b3 /lib/debug
parenteadeadb9a6bbb11c7f7e5ff49e9f430ce0e68cfe (diff)
ignore warnings in releases (#3081)
Diffstat (limited to 'lib/debug')
-rw-r--r--lib/debug/logging.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/debug/logging.py b/lib/debug/logging.py
index 4d3683b6..fa474348 100644
--- a/lib/debug/logging.py
+++ b/lib/debug/logging.py
@@ -100,10 +100,9 @@ def activate_logging(running_as_frozen: bool, ini: dict, SCRIPTDIR: Path):
# - PYTHONWARNINGS, -W - warnings action controlled by python
# actions: 'error', 'ignore', 'always', 'default', 'module', 'once'
def activate_for_frozen():
- loglevel = os.environ.get('INKSTITCH_LOGLEVEL') # read log level from environment variable or None
- docpath = os.environ.get('DOCUMENT_PATH') # read document path from environment variable (set by inkscape) or None
-
- if docpath is not None and loglevel is not None and loglevel.upper() in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
+ if frozen_debug_active():
+ loglevel = os.environ.get('INKSTITCH_LOGLEVEL') # read log level from environment variable or None
+ docpath = os.environ.get('DOCUMENT_PATH') # read document path from environment variable (set by inkscape) or None
# The end user enabled logging and warnings are redirected to the input_svg.inkstitch.log file.
@@ -122,7 +121,19 @@ def activate_for_frozen():
logging.captureWarnings(True) # capture all warnings to log file with level WARNING
else:
logging.disable() # globally disable all logging of all loggers
- warnings.simplefilter('ignore') # ignore all warnings
+ disable_warnings()
+
+
+def frozen_debug_active():
+ loglevel = os.environ.get('INKSTITCH_LOGLEVEL') # read log level from environment variable or None
+ docpath = os.environ.get('DOCUMENT_PATH') # read document path from environment variable (set by inkscape) or None
+ if docpath is not None and loglevel is not None and loglevel.upper() in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
+ return True
+ return False
+
+
+def disable_warnings():
+ warnings.simplefilter('ignore') # ignore all warnings
# in development mode we want to use configuration from some LOGGING.toml file