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:
Jon Brown 2024-01-04 05:35:17 -08:00 committed by GitHub
parent a9b8a00b70
commit ae00e82c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 20 deletions

View File

@ -7,6 +7,8 @@
## 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.
([#6581](https://github.com/mitmproxy/mitmproxy/pull/6581), @mhils)

View File

@ -25,9 +25,9 @@ them to keys in the interactive tools.
{{< example src="examples/addons/anatomy.py" lang="py" >}}
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
mitmproxy's internal logging mechanism to announce its tally. The output can be
found in the event log in the interactive tools, or on the console in mitmdump.
specifically HTTP requests) we've seen. Every time it sees a new flow, it
increments and logs its tally. The output can be found in the event log in the
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
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
method for each event they want to handle. Each event and its signature are documented
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

View File

@ -7,6 +7,8 @@ if typing.TYPE_CHECKING:
import mitmproxy.master
import mitmproxy.options
log: mitmproxy.log.Log
master: mitmproxy.master.Master
options: mitmproxy.options.Options
log: mitmproxy.log.Log
"""Deprecated: Use Python's builtin `logging` module instead."""