Fix JS logging
This commit is contained in:
parent
45ce7efc71
commit
3cee9cdcd7
@ -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 = {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user