aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple/log_events.py
diff options
context:
space:
mode:
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.")