remove mention of ctx.log from addon example (#6552)
[#5590](https://github.com/mitmproxy/mitmproxy/pull/5590) made the switch to standard logging, but this part of the addons documentation references the previous `ctx.log` approach.
This commit is contained in:
parent
a9b8a00b70
commit
ae00e82c3a
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
## Unreleased: mitmproxy next
|
## Unreleased: mitmproxy next
|
||||||
|
|
||||||
|
* Remove stale reference to `ctx.log` in addon documentation.
|
||||||
|
([#6552](https://github.com/mitmproxy/mitmproxy/pull/6552), @brojonat)
|
||||||
* Fix a bug where a traceback is shown during shutdown.
|
* Fix a bug where a traceback is shown during shutdown.
|
||||||
([#6581](https://github.com/mitmproxy/mitmproxy/pull/6581), @mhils)
|
([#6581](https://github.com/mitmproxy/mitmproxy/pull/6581), @mhils)
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ them to keys in the interactive tools.
|
||||||
{{< example src="examples/addons/anatomy.py" lang="py" >}}
|
{{< example src="examples/addons/anatomy.py" lang="py" >}}
|
||||||
|
|
||||||
Above is a simple addon that keeps track of the number of flows (or more
|
Above is a simple addon that keeps track of the number of flows (or more
|
||||||
specifically HTTP requests) we've seen. Every time it sees a new flow, it uses
|
specifically HTTP requests) we've seen. Every time it sees a new flow, it
|
||||||
mitmproxy's internal logging mechanism to announce its tally. The output can be
|
increments and logs its tally. The output can be found in the event log in the
|
||||||
found in the event log in the interactive tools, or on the console in mitmdump.
|
interactive tools, or on the console in mitmdump.
|
||||||
|
|
||||||
Take it for a spin and make sure that it does what it's supposed to, by loading
|
Take it for a spin and make sure that it does what it's supposed to, by loading
|
||||||
it into your mitmproxy tool of choice. We'll use mitmdump in these examples,
|
it into your mitmproxy tool of choice. We'll use mitmdump in these examples,
|
||||||
|
@ -45,11 +45,6 @@ Here are a few things to note about the code above:
|
||||||
- The `request` method is an example of an *event*. Addons simply implement a
|
- The `request` method is an example of an *event*. Addons simply implement a
|
||||||
method for each event they want to handle. Each event and its signature are documented
|
method for each event they want to handle. Each event and its signature are documented
|
||||||
in the [API documentation]({{< relref "addons-api" >}}).
|
in the [API documentation]({{< relref "addons-api" >}}).
|
||||||
- Finally, the `ctx` module is a holdall module that exposes a set of standard
|
|
||||||
objects that are commonly used in addons. We could pass a `ctx` object as the
|
|
||||||
first parameter to every event, but we've found it neater to just expose it as
|
|
||||||
an importable global. In this case, we're using the `ctx.log` object to do our
|
|
||||||
logging.
|
|
||||||
|
|
||||||
# Abbreviated Scripting Syntax
|
# Abbreviated Scripting Syntax
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ if typing.TYPE_CHECKING:
|
||||||
import mitmproxy.master
|
import mitmproxy.master
|
||||||
import mitmproxy.options
|
import mitmproxy.options
|
||||||
|
|
||||||
log: mitmproxy.log.Log
|
|
||||||
master: mitmproxy.master.Master
|
master: mitmproxy.master.Master
|
||||||
options: mitmproxy.options.Options
|
options: mitmproxy.options.Options
|
||||||
|
|
||||||
|
log: mitmproxy.log.Log
|
||||||
|
"""Deprecated: Use Python's builtin `logging` module instead."""
|
||||||
|
|
Loading…
Reference in New Issue