Add option to mask info

This commit is contained in:
angelblue05 2018-09-13 23:55:39 -05:00
parent 7672410601
commit 3984d4e0a0
4 changed files with 15 additions and 6 deletions

View file

@ -793,3 +793,7 @@ msgstr ""
msgctxt "#33163" msgctxt "#33163"
msgid "Support this project" msgid "Support this project"
msgstr "" msgstr ""
msgctxt "#33164"
msgid "Mask sensitive information in log (does not apply to kodi logging)"
msgstr ""

View file

@ -151,7 +151,8 @@ class Service(xbmc.Monitor):
return return
if get_objects(zipfile, label + '.zip'): # no patch applied previously if get_objects(zipfile, label + '.zip'):
LOG.info("No previous patch found.") LOG.info("No previous patch found.")
dialog("ok", heading="{emby}", line1=_(33135)) dialog("ok", heading="{emby}", line1=_(33135))
xbmc.executebuiltin('RestartApp') xbmc.executebuiltin('RestartApp')

View file

@ -7,7 +7,7 @@ import logging
import xbmc import xbmc
import database import database
from . import window from . import window, settings
################################################################################################## ##################################################################################################
@ -42,17 +42,20 @@ class LogHandler(logging.StreamHandler):
if server.get('ManualAddress'): if server.get('ManualAddress'):
self.sensitive['Server'].append(server['ManualAddress'].split('://')[1]) self.sensitive['Server'].append(server['ManualAddress'].split('://')[1])
self.mask_info = settings('maskInfo.bool')
def emit(self, record): def emit(self, record):
if self._get_log_level(record.levelno): if self._get_log_level(record.levelno):
string = self.format(record) string = self.format(record)
if self.mask_info:
for server in self.sensitive['Server']: for server in self.sensitive['Server']:
string = string.replace(server or "{server}", "{emby-server}") string = string.replace(server or "{server}", "{emby-server}")
for token in self.sensitive['Token']: for token in self.sensitive['Token']:
string = string.replace(token or "{token}", "{emby-token}") string = string.replace(token or "{token}", "{emby-token}")
try: try:
xbmc.log(string, level=xbmc.LOGNOTICE) xbmc.log(string, level=xbmc.LOGNOTICE)
except UnicodeEncodeError: except UnicodeEncodeError:

View file

@ -83,6 +83,7 @@
<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="1" />
<setting label="33164" id="maskInfo" type="bool" default="true" />
<setting label="30529" id="startupDelay" type="number" default="0" option="int" /> <setting label="30529" id="startupDelay" type="number" default="0" option="int" />
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=reset)" option="close" /> <setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=reset)" option="close" />
<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=deviceid)" option="close" /> <setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=deviceid)" option="close" />