mirror of https://github.com/vee1e/mitmproxy - An interactive TLS-capable intercepting HTTP proxy for penet
Find a file
Maximilian Hils c69239bb90 switch to stdlib logging
mitmproxy previously used a homegrown logging mechanism based around
`mitmproxy.ctx.log` and the `add_log` hook. This worked well for everything
we control, but does not work outside the mitmproxy universe.
For now we have simply ignored logging in e.g. tornado or h2, but with the
upcoming introduction of mitmproxy_wireguard we now have a dependency
on some Rust/PyO3 code for which we definitely want logs, but which also
cannot easily be changed to use our homegrown logging (PyO3 does the heavy
lifting to add interoperability with stdlib logging). Long story short,
we want to introduce a log handler for stdlib logging.

Now there are two ways how such a handler could operate:

 1. We could build a handler that forwards all stdlib log events
    into our homegrown mechanism.
 2. We embrace stdlib's logging as the correct way to do things,
    and get rid of our homegrown stuff.

This PR follows the second approach by removing the `add_log` hook and
rewriting the `TermLog` and `EventStore` addons to listen for stdlib log records.
This means that all `mitmproxy.ctx.log.info` events are now simply `logging.info` etc.

One upside of this approach is that many parts of the codebase now don't depend
on the existence of `mitmproxy.ctx` and we can use off-the-shelf things like pytest's
`caplog`. We can also now better colorize log output and/or add timestamps.
2022-09-17 17:28:35 +02:00
.github Magisk module onboarding for Android (#5547) 2022-08-23 14:52:11 +00:00
docs switch to stdlib logging 2022-09-17 17:28:35 +02:00
examples switch to stdlib logging 2022-09-17 17:28:35 +02:00
mitmproxy switch to stdlib logging 2022-09-17 17:28:35 +02:00
release Docker: assume uid of who holds permissions (#5550) 2022-09-08 17:42:09 +00:00
test switch to stdlib logging 2022-09-17 17:28:35 +02:00
web fix issue #5198: mitmWeb crash (#5507) 2022-09-09 17:27:25 +02:00
.gitattributes test dumpfiles: .bin -> .mitm 2021-02-03 19:27:15 +01:00
.gitignore update kaitai definitions 2022-07-29 16:13:15 +02:00
CHANGELOG.md switch to stdlib logging 2022-09-17 17:28:35 +02:00
codecov.yml remove release/ from coverage 2022-07-25 01:39:04 +02:00
CONTRIBUTING.md drop support for Python 3.8 2022-04-26 13:53:04 +02:00
LICENSE
MANIFEST.in remove pathod and pathoc 2020-12-13 20:21:11 +01:00
README.md StackOverflow -> GitHub Discussions 2021-11-16 10:26:38 +01:00
SECURITY.md Create SECURITY.md 2021-09-13 16:34:33 +02:00
setup.cfg add HTTP/3 content view 2022-09-13 09:00:09 +02:00
setup.py [requires.io] dependency update (#5577) 2022-09-11 13:31:14 +02:00
tox.ini [requires.io] dependency update on main branch (#5573) 2022-09-10 17:05:17 +02:00

mitmproxy

Continuous Integration Status Coverage Status Latest Version Supported Python versions

mitmproxy is an interactive, SSL/TLS-capable intercepting proxy with a console interface for HTTP/1, HTTP/2, and WebSockets.

mitmdump is the command-line version of mitmproxy. Think tcpdump for HTTP.

mitmweb is a web-based interface for mitmproxy.

Installation

The installation instructions are here. If you want to install from source, see CONTRIBUTING.md.

Documentation & Help

General information, tutorials, and precompiled binaries can be found on the mitmproxy website.

mitmproxy.org

The documentation for mitmproxy is available on our website:

mitmproxy documentation stable mitmproxy documentation dev

If you have questions on how to use mitmproxy, please use GitHub Discussions!

mitmproxy discussions

Contributing

As an open source project, mitmproxy welcomes contributions of all forms.

Dev Guide

Also, please feel free to join our developer Slack!

Slack Developer Chat