Updated debug logging for sanitising user data

This commit is contained in:
Abby Gourlay 2020-03-08 16:29:15 +00:00
parent 298c8b6f25
commit 36cd765c21
4 changed files with 28 additions and 5 deletions

View file

@ -398,8 +398,8 @@ class API(object):
if not settings('sslverify'): if not settings('sslverify'):
request_settings["verify"] = False request_settings["verify"] = False
LOG.info("Sending %s request to %s" % (method, url)) LOG.info("Sending %s request to %s" % (method, path))
LOG.debug(request_settings) LOG.debug(request_settings['timeout'], request_settings['headers'])
return request_method(url, **request_settings) return request_method(url, **request_settings)

View file

@ -173,6 +173,7 @@ class ConnectionManager(object):
return { 'State': CONNECTION_STATE['Unavailable'] } return { 'State': CONNECTION_STATE['Unavailable'] }
def connect(self, options={}): def connect(self, options={}):
LOG.info("Begin connect") LOG.info("Begin connect")
servers = self.get_available_servers() servers = self.get_available_servers()
@ -207,7 +208,6 @@ class ConnectionManager(object):
return self.client.jellyfin.get_public_users() return self.client.jellyfin.get_public_users()
def _server_discovery(self): def _server_discovery(self):
MULTI_GROUP = ("<broadcast>", 7359) MULTI_GROUP = ("<broadcast>", 7359)
MESSAGE = b"who is JellyfinServer?" MESSAGE = b"who is JellyfinServer?"

View file

@ -127,6 +127,13 @@ class Library(threading.Thread):
@stop() @stop()
def service(self): def service(self):
from kodi_six import xbmc, xbmcaddon
from datetime import datetime
path = xbmcaddon.Addon(id='plugin.video.jellyfin').getAddonInfo('path')
from pyinstrument import Profiler
profiler = Profiler()
profiler.start()
''' If error is encountered, it will rerun this function. ''' If error is encountered, it will rerun this function.
Start new "daemon threads" to process library updates. Start new "daemon threads" to process library updates.
(actual daemon thread is not supported in Kodi) (actual daemon thread is not supported in Kodi)
@ -146,8 +153,17 @@ class Library(threading.Thread):
self.worker_userdata() self.worker_userdata()
self.worker_remove() self.worker_remove()
self.worker_notify() self.worker_notify()
profiler.stop()
with open(str(path)+'/output-'+str(datetime.now())+'.html', 'w+') as output:
output.write(profiler.output_html().encode('utf-8'))
if self.pending_refresh: if self.pending_refresh:
from kodi_six import xbmc, xbmcaddon
from datetime import datetime
path = xbmcaddon.Addon(id='plugin.video.jellyfin').getAddonInfo('path')
from pyinstrument import Profiler
profiler = Profiler()
profiler.start()
window('jellyfin_sync.bool', True) window('jellyfin_sync.bool', True)
if self.total_updates > self.progress_display: if self.total_updates > self.progress_display:
@ -169,6 +185,11 @@ class Library(threading.Thread):
self.screensaver = get_screensaver() self.screensaver = get_screensaver()
set_screensaver(value="") set_screensaver(value="")
profiler.stop()
with open(str(path)+'/output-'+str(datetime.now())+'.html', 'w+') as output:
output.write(profiler.output_html().encode('utf-8'))
if (self.pending_refresh and not self.download_threads and not self.writer_threads['updated'] and not self.writer_threads['userdata'] and not self.writer_threads['removed']): if (self.pending_refresh and not self.download_threads and not self.writer_threads['updated'] and not self.writer_threads['userdata'] and not self.writer_threads['removed']):
self.pending_refresh = False self.pending_refresh = False
self.save_last_sync() self.save_last_sync()
@ -194,6 +215,8 @@ class Library(threading.Thread):
if xbmc.getCondVisibility('Window.IsMedia'): if xbmc.getCondVisibility('Window.IsMedia'):
xbmc.executebuiltin('Container.Refresh') xbmc.executebuiltin('Container.Refresh')
def stop_client(self): def stop_client(self):
self.stop_thread = True self.stop_thread = True

View file

@ -85,7 +85,7 @@
</category> </category>
<category label="30022"><!-- Advanced --> <category label="30022"><!-- Advanced -->
<setting label="30004" id="logLevel" type="enum" values="Disabled|Info|Debug" default="1" /> <setting label="30004" id="logLevel" type="enum" values="Disabled|Info|Debug" default="2" />
<setting label="33164" id="maskInfo" type="bool" default="true" /> <setting label="33164" id="maskInfo" type="bool" default="true" />
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.jellyfin?mode=reset)" option="close" /> <setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.jellyfin?mode=reset)" option="close" />
<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.jellyfin?mode=deviceid)" option="close" /> <setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.jellyfin?mode=deviceid)" option="close" />