fix: #396 Using kodi_version to determine loglevel

This commit is contained in:
David Francos 2020-09-17 10:38:22 +02:00
parent cf1ee30e18
commit ad941ae483

View file

@ -14,6 +14,7 @@ import database
from helper import get_filesystem_encoding from helper import get_filesystem_encoding
from . import settings from . import settings
from . import kodi_version
################################################################################################## ##################################################################################################
@ -49,6 +50,11 @@ class LogHandler(logging.StreamHandler):
self.mask_info = settings('maskInfo.bool') self.mask_info = settings('maskInfo.bool')
if kodi_version() > 18:
self.level = xbmc.LOGINFO
else:
self.level = xbmc.LOGNOTICE
def emit(self, record): def emit(self, record):
if self._get_log_level(record.levelno): if self._get_log_level(record.levelno):
@ -61,7 +67,7 @@ class LogHandler(logging.StreamHandler):
for token in self.sensitive['Token']: for token in self.sensitive['Token']:
string = string.replace(token or "{token}", "{jellyfin-token}") string = string.replace(token or "{token}", "{jellyfin-token}")
xbmc.log(string, level=getattr(xbmc, 'LOGNOTICE', xbmc.LOGINFO)) xbmc.log(string, level=self.level)
@classmethod @classmethod