Replies: 2 comments
-
I don't have an immediate answer for you, but you can check what we do for logging here: Lines 37 to 39 in 6bd19a7 https://github.com/mitmproxy/mitmproxy/blob/main/mitmproxy/addons/termlog.py https://github.com/mitmproxy/mitmproxy/blob/main/mitmproxy/log.py |
Beta Was this translation helpful? Give feedback.
-
Termlog logs use print and will go to stdout: mitmproxy/mitmproxy/addons/termlog.py Line 46 in 6c7089f Depending on your specific configuration the root logger handler will look something like this: [<TermLogHandler (DEBUG)>, <LegacyLogEvents (NOTSET)>, <ErrorCheckHandler (ERROR)> ]. Depending on your requirements you could redirect stdout from the mitmproxy/mitmdump command invocation to one of your log handlers which does not require a code change. Or you could add a handler to the root logger, taking care of the propagate option, which would send termlog events to the handler or do other modifications to the root handlers. |
Beta Was this translation helpful? Give feedback.
-
I am using DumpMaster to run mitmproxy.
My problem is that I see that there are mitmproxy outputs like these:
[10:07:35.657][127.0.0.1:64469] client disconnect
[10:07:36.266][127.0.0.1:64467] Streaming response from edgeapi.slack.com.
They are output to stdout, but I would like to redirect them to my own logger which I get from logger = logging.getLogger(mod_name)
Is there an easy way to do this?
Beta Was this translation helpful? Give feedback.
All reactions