aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple/log_events.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-12-19 16:21:29 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-12-19 16:21:29 +0100
commitfc5783c20e86122ca687aa41b00ca29bc852cc0c (patch)
treeb9bbb84b7b92e38b2ae41a1a02624a640b57a9b0 /examples/simple/log_events.py
parent4f3b50e417ceee79a358296a35e94f8ce13fc91b (diff)
parent98a079aa692fe532e54a5b919d939bf7772af8fd (diff)
downloadmitmproxy-fc5783c20e86122ca687aa41b00ca29bc852cc0c.tar.gz
mitmproxy-fc5783c20e86122ca687aa41b00ca29bc852cc0c.tar.bz2
mitmproxy-fc5783c20e86122ca687aa41b00ca29bc852cc0c.zip
Merge branch 'rename-log-example'
Diffstat (limited to 'examples/simple/log_events.py')
-rw-r--r--examples/simple/log_events.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/simple/log_events.py b/examples/simple/log_events.py
new file mode 100644
index 00000000..ab1baf75
--- /dev/null
+++ b/examples/simple/log_events.py
@@ -0,0 +1,12 @@
+"""
+It is recommended to use `ctx.log` for logging within a script.
+This goes to the event log in mitmproxy and to stdout in mitmdump.
+
+If you want to help us out: https://github.com/mitmproxy/mitmproxy/issues/1530 :-)
+"""
+from mitmproxy import ctx
+
+
+def start():
+ ctx.log.info("This is some informative text.")
+ ctx.log.error("This is an error.")