From 23b9ef799eb0d322c7dcfe796b196cce3cea6435 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Tue, 9 Aug 2016 10:29:41 +0530 Subject: [PATCH] Add a ctx.log on finish --- examples/har_dump.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/har_dump.py b/examples/har_dump.py index 5acd8bfad..56508cdc5 100644 --- a/examples/har_dump.py +++ b/examples/har_dump.py @@ -120,10 +120,12 @@ def done(): mitmproxy.ctx.log(pprint.pformat(HAR)) # TODO: .zhar compression else: - with open(dump_file, "w") as f: - f.write(json.dumps(HAR, indent=2)) + json_dump = 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):