mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Strip pluginpath from logged stacktraces
This commit is contained in:
parent
9ae99de8dd
commit
c559f2fff6
1 changed files with 17 additions and 0 deletions
|
@ -7,6 +7,7 @@ from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
import traceback
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
|
@ -119,6 +120,22 @@ class MyFormatter(logging.Formatter):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def formatException(self, exc_info):
|
||||||
|
_pluginpath_real = os.path.realpath(__pluginpath__)
|
||||||
|
res = []
|
||||||
|
|
||||||
|
for o in traceback.format_exception(*exc_info):
|
||||||
|
if o.startswith(' File "'):
|
||||||
|
# If this split can't handle your file names, you should seriously consider renaming your files.
|
||||||
|
fn = o.split(' File "', 2)[1].split('", line ', 1)[0]
|
||||||
|
rfn = os.path.realpath(fn)
|
||||||
|
if rfn.startswith(_pluginpath_real):
|
||||||
|
o = o.replace(fn, os.path.relpath(rfn, _pluginpath_real))
|
||||||
|
|
||||||
|
res.append(o)
|
||||||
|
|
||||||
|
return ''.join(res)
|
||||||
|
|
||||||
def _gen_rel_path(self, record):
|
def _gen_rel_path(self, record):
|
||||||
if record.pathname:
|
if record.pathname:
|
||||||
record.relpath = os.path.relpath(record.pathname, __pluginpath__)
|
record.relpath = os.path.relpath(record.pathname, __pluginpath__)
|
||||||
|
|
Loading…
Reference in a new issue