Add a ctx.log on finish

This commit is contained in:
Shadab Zafar 2016-08-09 10:29:41 +05:30
parent 456f80d862
commit 23b9ef799e

View File

@ -120,10 +120,12 @@ def done():
mitmproxy.ctx.log(pprint.pformat(HAR)) mitmproxy.ctx.log(pprint.pformat(HAR))
# TODO: .zhar compression # TODO: .zhar compression
else: else:
with open(dump_file, "w") as f: json_dump = json.dumps(HAR, indent=2)
f.write(json.dumps(HAR, indent=2))
# TODO: Log results via mitmproxy.ctx.log with open(dump_file, "w") as f:
f.write(json_dump)
mitmproxy.ctx.log("HAR log finished (wrote %s bytes to file)" % len(json_dump))
def format_datetime(dt): def format_datetime(dt):