mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Overwriting logging.Formatter._fmt
seems to
no longer work in Python 3
This commit is contained in:
parent
795dfd38df
commit
6c5ac6292d
1 changed files with 2 additions and 17 deletions
|
@ -61,9 +61,6 @@ class LogHandler(logging.StreamHandler):
|
|||
for token in self.sensitive['Token']:
|
||||
string = string.replace(token or "{token}", "{jellyfin-token}")
|
||||
|
||||
try:
|
||||
xbmc.log(string, level=xbmc.LOGNOTICE)
|
||||
except UnicodeEncodeError:
|
||||
xbmc.log(string, level=xbmc.LOGNOTICE)
|
||||
|
||||
@classmethod
|
||||
|
@ -85,27 +82,15 @@ class LogHandler(logging.StreamHandler):
|
|||
|
||||
class MyFormatter(logging.Formatter):
|
||||
|
||||
def __init__(self, fmt="%(name)s -> %(message)s"):
|
||||
|
||||
def __init__(self, fmt='%(name)s -> %(levelname)s::%(relpath)s:%(lineno)s %(message)s'):
|
||||
logging.Formatter.__init__(self, fmt)
|
||||
|
||||
def format(self, record):
|
||||
|
||||
# Save the original format configured by the user
|
||||
# when the logger formatter was instantiated
|
||||
format_orig = self._fmt
|
||||
|
||||
self._gen_rel_path(record)
|
||||
|
||||
# Replace the original format with one customized by logging level
|
||||
self._fmt = '%(name)s -> %(levelname)s::%(relpath)s:%(lineno)s %(message)s'
|
||||
|
||||
# Call the original formatter class to do the grunt work
|
||||
result = logging.Formatter.format(self, record)
|
||||
|
||||
# Restore the original format configured by the user
|
||||
self._fmt = format_orig
|
||||
|
||||
return result
|
||||
|
||||
def formatException(self, exc_info):
|
||||
|
|
Loading…
Reference in a new issue