aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple/log_events.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2016-12-24 11:20:12 +1300
committerGitHub <noreply@github.com>2016-12-24 11:20:12 +1300
commit5167d59d63e8f70770119a26804feaad17fccb8f (patch)
tree8d31230fb601d7da87ee5d9da46a0a554c12b0ed /examples/simple/log_events.py
parent9f1cbe8746df6096e877b2cc57d386ff08f079d8 (diff)
parent24751965f99daf83c82d9c1581f712ca24da9d3d (diff)
downloadmitmproxy-5167d59d63e8f70770119a26804feaad17fccb8f.tar.gz
mitmproxy-5167d59d63e8f70770119a26804feaad17fccb8f.tar.bz2
mitmproxy-5167d59d63e8f70770119a26804feaad17fccb8f.zip
Merge branch 'master' into admin
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.")