From 6559bdfbfd3bc5dfc20ac925e5039340593e8ebc Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Wed, 30 Oct 2024 21:33:33 +0100 Subject: [PATCH 1/3] log is now on stdout, except errors that are on stderr --- addons/io_scene_gltf2/io/com/debug.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/addons/io_scene_gltf2/io/com/debug.py b/addons/io_scene_gltf2/io/com/debug.py index 697ce5457..7fae9cd89 100644 --- a/addons/io_scene_gltf2/io/com/debug.py +++ b/addons/io_scene_gltf2/io/com/debug.py @@ -19,6 +19,7 @@ import time import logging import logging.handlers +import sys # # Globals @@ -75,22 +76,30 @@ def profile_end(label=None): class Log: def __init__(self, loglevel): self.logger = logging.getLogger('glTFImporter') + self.error_logger = logging.getLogger('glTFImporter_errors') # For console display - self.console_handler = logging.StreamHandler() + self.console_handler = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('%(asctime)s | %(levelname)s: %(message)s', "%H:%M:%S") self.console_handler.setFormatter(formatter) + # For console display - errors + self.error_console_handler = logging.StreamHandler(sys.stderr) + formatter_error = logging.Formatter('%(asctime)s | %(levelname)s: %(message)s', "%H:%M:%S") + self.error_console_handler.setFormatter(formatter_error) + # For popup display self.popup_handler = logging.handlers.MemoryHandler(1024 * 10) self.logger.addHandler(self.console_handler) + self.error_logger.addHandler(self.error_console_handler) # self.logger.addHandler(self.popup_handler) => Make sure to not attach the popup handler to the logger self.logger.setLevel(int(loglevel)) + self.error_logger.setLevel(logging.ERROR) def error(self, message, popup=False): - self.logger.error(message) + self.error_logger.error(message) if popup: self.popup_handler.buffer.append(('ERROR', message)) @@ -110,7 +119,7 @@ def debug(self, message, popup=False): self.popup_handler.buffer.append(('DEBUG', message)) def critical(self, message, popup=False): - self.logger.critical(message) + self.error_logger.critical(message) if popup: # There is no Critical level in Blender, so we use error self.popup_handler.buffer.append(('ERROR', message)) @@ -125,5 +134,6 @@ def messages(self): def flush(self): self.logger.removeHandler(self.console_handler) + self.error_logger.removeHandler(self.error_console_handler) self.popup_handler.flush() self.logger.removeHandler(self.popup_handler) From c1ad9f0cf3c9a181fa19ceb2952cdfcca569c169 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Wed, 30 Oct 2024 22:17:11 +0100 Subject: [PATCH 2/3] get export loglevel from ops parameter If not set, get it from app debug value --- addons/io_scene_gltf2/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/io_scene_gltf2/__init__.py b/addons/io_scene_gltf2/__init__.py index 83efca6e5..1fd72108d 100644 --- a/addons/io_scene_gltf2/__init__.py +++ b/addons/io_scene_gltf2/__init__.py @@ -991,6 +991,12 @@ class ExportGLTF2_Base(ConvertGLTF2_Base): default=False ) + export_loglevel: IntProperty( + name='Log Level', + description="Log Level", + default=-1, + ) + # Custom scene property for saving settings scene_key = "glTF2ExportSettings" @@ -1076,7 +1082,11 @@ def execute(self, context): # All custom export settings are stored in this container. export_settings = {} - export_settings['loglevel'] = set_debug_log() + # Get log level from parameters + # If not set, get it from Blender app debug value + export_settings['gltf_loglevel'] = self.export_loglevel + if export_settings['gltf_loglevel'] < 0: + export_settings['loglevel'] = set_debug_log() export_settings['exported_images'] = {} export_settings['exported_texture_nodes'] = [] From b76c8d8a2ad844d657ea1c1d599a1d5bc9fe6bf2 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Thu, 31 Oct 2024 14:30:09 +0100 Subject: [PATCH 3/3] Bump to 4.3.45 --- addons/io_scene_gltf2/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/io_scene_gltf2/__init__.py b/addons/io_scene_gltf2/__init__.py index 56e38a37a..bc0f38737 100644 --- a/addons/io_scene_gltf2/__init__.py +++ b/addons/io_scene_gltf2/__init__.py @@ -15,7 +15,7 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', - "version": (4, 3, 44), + "version": (4, 3, 45), 'blender': (4, 3, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0',