From 98a079aa692fe532e54a5b919d939bf7772af8fd Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 19 Dec 2016 15:50:33 +0100 Subject: rename logging.py example. this conflicted with Python's stdlib --- docs/scripting/overview.rst | 4 ++-- examples/simple/log_events.py | 12 ++++++++++++ examples/simple/logging.py | 12 ------------ 3 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 examples/simple/log_events.py delete mode 100644 examples/simple/logging.py diff --git a/docs/scripting/overview.rst b/docs/scripting/overview.rst index 84f2135e..6ec0caaa 100644 --- a/docs/scripting/overview.rst +++ b/docs/scripting/overview.rst @@ -85,8 +85,8 @@ and mitmproxy console can place script output in the event buffer. Here's how this looks: -.. literalinclude:: ../../examples/simple/logging.py - :caption: :src:`examples/simple/logging.py` +.. literalinclude:: ../../examples/simple/log_events.py + :caption: :src:`examples/simple/log_events.py` :language: python The ``ctx`` module also exposes the mitmproxy master object at ``ctx.master`` 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.") diff --git a/examples/simple/logging.py b/examples/simple/logging.py deleted file mode 100644 index ab1baf75..00000000 --- a/examples/simple/logging.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -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.") -- cgit v1.2.3