Skip to content

Commit aab759a

Browse files
committed
Corrige les logs imbriqués et doublons dans le chargement des tabs
Évite les écritures incohérentes en normalisant le fallback de log dans EngineLoader.base et en supprimant le double logging dans EngineLoader.registry. Objectif: une information par ligne, sans duplication, pour garder un journal lisible.
1 parent 00c7544 commit aab759a

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

EngineLoader/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def log_i18n_level(gui, level: str, fr: str, en: str) -> None:
4646
label = labels.get(lvl, str(level).upper())
4747
line = f"[{label}] {msg}"
4848
try:
49-
if hasattr(gui, "log") and gui.log:
49+
if hasattr(gui, "log") and getattr(gui, "log", None) is not None:
5050
gui.log.append(line)
5151
return
5252
except Exception:

EngineLoader/registry.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,6 @@ def _log_tab_load_issue(eid: str, fr: str, en: str, exc: Exception | None = None
336336
log_i18n_level(gui, "warning", fr, en)
337337
except Exception:
338338
pass
339-
try:
340-
_debug_log("warning", fr, en)
341-
except Exception:
342-
pass
343339
try:
344340
if exc is None:
345341
logger.warning("%s", en)
@@ -383,30 +379,26 @@ def _wrap_tab_scroll(widget):
383379
return widget
384380

385381
def _debug_log(level: str, fr: str, en: str) -> None:
386-
did_log = False
387382
try:
388383
from .base import log_i18n_level as _log_i18n_level
389384

390385
_log_i18n_level(gui, level, fr, en)
391-
did_log = True
386+
return
392387
except Exception:
393388
pass
394389
try:
395390
msg = en
396-
try:
391+
if hasattr(gui, "tr") and callable(getattr(gui, "tr")):
392+
msg = gui.tr(fr, en)
393+
else:
397394
cur = getattr(gui, "current_language", None)
398395
if isinstance(cur, str) and cur.lower().startswith("fr"):
399396
msg = fr
400-
except Exception:
401-
pass
402-
if hasattr(gui, "tr") and callable(getattr(gui, "tr")):
403-
msg = gui.tr(fr, en)
404397
line = f"[{level.upper()}] {msg}"
405398
if hasattr(gui, "log") and getattr(gui, "log", None) is not None:
406399
gui.log.append(line)
407400
else:
408-
if not did_log:
409-
print(line)
401+
print(line)
410402
except Exception:
411403
pass
412404

0 commit comments

Comments
 (0)