Merge pull request #1822 from cortesi/clog
console: use an addon to capture logs
This commit is contained in:
commit
fdd1e23875
|
@ -38,6 +38,11 @@ from mitmproxy.net import tcp
|
||||||
EVENTLOG_SIZE = 500
|
EVENTLOG_SIZE = 500
|
||||||
|
|
||||||
|
|
||||||
|
class Logger:
|
||||||
|
def log(self, evt):
|
||||||
|
signals.add_log(evt.msg, evt.level)
|
||||||
|
|
||||||
|
|
||||||
class ConsoleMaster(master.Master):
|
class ConsoleMaster(master.Master):
|
||||||
palette = []
|
palette = []
|
||||||
|
|
||||||
|
@ -58,6 +63,7 @@ class ConsoleMaster(master.Master):
|
||||||
signals.replace_view_state.connect(self.sig_replace_view_state)
|
signals.replace_view_state.connect(self.sig_replace_view_state)
|
||||||
signals.push_view_state.connect(self.sig_push_view_state)
|
signals.push_view_state.connect(self.sig_push_view_state)
|
||||||
signals.sig_add_log.connect(self.sig_add_log)
|
signals.sig_add_log.connect(self.sig_add_log)
|
||||||
|
self.addons.add(Logger())
|
||||||
self.addons.add(*addons.default_addons())
|
self.addons.add(*addons.default_addons())
|
||||||
self.addons.add(intercept.Intercept(), self.view)
|
self.addons.add(intercept.Intercept(), self.view)
|
||||||
|
|
||||||
|
@ -447,7 +453,3 @@ class ConsoleMaster(master.Master):
|
||||||
direction=direction,
|
direction=direction,
|
||||||
), "info")
|
), "info")
|
||||||
signals.add_log(strutils.bytes_to_escaped_str(message.content), "debug")
|
signals.add_log(strutils.bytes_to_escaped_str(message.content), "debug")
|
||||||
|
|
||||||
@controller.handler
|
|
||||||
def log(self, evt):
|
|
||||||
signals.add_log(evt.msg, evt.level)
|
|
||||||
|
|
Loading…
Reference in New Issue