Fix JS logging

This commit is contained in:
Florian Bruhin 2017-06-13 16:21:03 +02:00
parent 45ce7efc71
commit 3cee9cdcd7
2 changed files with 3 additions and 5 deletions

View File

@ -276,8 +276,7 @@ class WebEnginePage(QWebEnginePage):
def javaScriptConsoleMessage(self, level, msg, line, source):
"""Log javascript messages to qutebrowser's log."""
# FIXME:qtwebengine maybe unify this in the tab api somehow?
setting = config.val.log_javascript_console
if setting == 'none':
if config.val.content.javascript.log == 'none':
return
level_to_logger = {

View File

@ -446,15 +446,14 @@ class BrowserPage(QWebPage):
def javaScriptConsoleMessage(self, msg, line, source):
"""Override javaScriptConsoleMessage to use debug log."""
log_javascript_console = config.get('general',
'log-javascript-console')
logstring = "[{}:{}] {}".format(source, line, msg)
logmap = {
'debug': log.js.debug,
'info': log.js.info,
'none': lambda arg: None
}
logmap[log_javascript_console](logstring)
logger = logmap[config.val.content.javascript.log]
logger(logstring)
def acceptNavigationRequest(self,
_frame: QWebFrame,