aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple/log_events.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-12-19 15:50:33 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-12-19 16:21:17 +0100
commit98a079aa692fe532e54a5b919d939bf7772af8fd (patch)
treea8e7ef6e40797fd6ebd05d384c3795787254ea62 /examples/simple/log_events.py
parentcbc0d3fd410f50508fdd7b4cb05bac8f6a18a3a4 (diff)
downloadmitmproxy-98a079aa692fe532e54a5b919d939bf7772af8fd.tar.gz
mitmproxy-98a079aa692fe532e54a5b919d939bf7772af8fd.tar.bz2
mitmproxy-98a079aa692fe532e54a5b919d939bf7772af8fd.zip
rename logging.py example. this conflicted with Python's stdlib
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.")