Fix installation failure when Kodi logging is disabled
Some checks failed
Build JellyCon / build (py2) (push) Has been cancelled
Build JellyCon / build (py3) (push) Has been cancelled
CodeQL Analysis / analyze (python, 3.9) (push) Has been cancelled
Release Drafter / Update release draft (push) Has been cancelled
Test JellyCon / test (3.9) (push) Has been cancelled

Add exception handling in LogHandler.emit() to prevent crashes
when xbmc.log() fails due to globally disabled logging in Kodi.
This commit is contained in:
mani
2026-01-06 01:03:53 +01:00
parent 44ad891242
commit 7d6ee45263

View File

@@ -39,6 +39,7 @@ class LogHandler(logging.StreamHandler):
def emit(self, record):
if self._get_log_level(record.levelno):
try:
string = self.format(record)
# Hide server URL in logs
@@ -53,6 +54,9 @@ class LogHandler(logging.StreamHandler):
else:
log_level = xbmc.LOGNOTICE
xbmc.log(string, level=log_level)
except Exception:
# Silently fail if logging is disabled globally in Kodi
pass
def _get_log_level(self, level):