mitmproxy/docs
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
..
bucketassets master branch -> main branch 2021-03-30 15:30:45 +02:00
raw
scripts switch to stdlib logging 2022-09-17 17:28:35 +02:00
src switch to stdlib logging 2022-09-17 17:28:35 +02:00
.gitignore
build.py make it black! 2022-04-28 19:11:10 +02:00
modd.conf docs: first prototype to link from events to API reference 2021-02-05 09:15:54 +01:00
README.md Update README.md (#4620) 2021-06-04 09:14:11 +00:00
setup.sh
upload-archive.sh Improve Shell Script syntax (#4497) 2021-03-11 19:12:03 +01:00
upload-stable.sh clean doc folder before building, fixes #4405 (#4406) 2021-01-22 01:40:08 +01:00

Mitmproxy Documentation

This directory houses the mitmproxy documentation available at https://docs.mitmproxy.org/.

Prerequisites

  1. Install hugo "extended".
  2. Windows users: Depending on your git settings, you may need to manually create a symlink from /docs/src/examples to /examples.

Editing docs locally

  1. Make sure the mitmproxy Python package is installed and the virtual python environment was activated. See CONTRIBUTING.md for details.
  2. Run ./build.py to generate additional documentation source files.
  3. Now you can change your working directory to ./src and run hugo server -D.