Merge pull request #398 from XayOn/feature/396-b

Fix removed log level in Kodi 19
This commit is contained in:
Odd Stråbø 2020-09-17 18:13:18 +02:00 committed by GitHub
commit 66e8593d97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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,8 @@ 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=xbmc.LOGNOTICE) xbmc.log(string, level=self.level)
@classmethod @classmethod
def _get_log_level(cls, level): def _get_log_level(cls, level):