diff --git a/resources/lib/loghandler.py b/resources/lib/loghandler.py index b7bb8789..e6df6059 100644 --- a/resources/lib/loghandler.py +++ b/resources/lib/loghandler.py @@ -12,22 +12,6 @@ LEVELS = { ############################################################################### -def try_encode(uniString, encoding='utf-8'): - """ - Will try to encode uniString (in unicode) to encoding. This possibly - fails with e.g. Android TV's Python, which does not accept arguments for - string.encode() - """ - if isinstance(uniString, str): - # already encoded - return uniString - try: - uniString = uniString.encode(encoding, "ignore") - except TypeError: - uniString = uniString.encode() - return uniString - - def config(): logger = logging.getLogger('PLEX') logger.addHandler(LogHandler()) @@ -40,10 +24,4 @@ class LogHandler(logging.StreamHandler): self.setFormatter(logging.Formatter(fmt='%(name)s: %(message)s')) def emit(self, record): - if isinstance(record.msg, str): - record.msg = record.msg.encode('utf-8') - try: - xbmc.log(self.format(record), level=LEVELS[record.levelno]) - except UnicodeEncodeError: - xbmc.log(try_encode(self.format(record)), - level=LEVELS[record.levelno]) + xbmc.log(self.format(record), level=LEVELS[record.levelno])