mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Fix log level handling
We have 4: error, warn, info and debug.
This commit is contained in:
parent
532ae7dc4a
commit
5a60f32c55
@ -284,7 +284,7 @@ def basic_options(parser):
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v", "--verbose",
|
||||
action="store_const", dest="verbose", default=1, const=2,
|
||||
action="store_const", dest="verbose", default=2, const=3,
|
||||
help="Increase event log verbosity."
|
||||
)
|
||||
outfile = parser.add_mutually_exclusive_group()
|
||||
|
@ -24,7 +24,7 @@ class Palette:
|
||||
# List and Connections
|
||||
'method', 'focus',
|
||||
'code_200', 'code_300', 'code_400', 'code_500', 'code_other',
|
||||
'error',
|
||||
'error', "warn",
|
||||
'header', 'highlight', 'intercept', 'replay', 'mark',
|
||||
|
||||
# Hex view
|
||||
@ -100,6 +100,7 @@ class LowDark(Palette):
|
||||
code_500 = ('light red', 'default'),
|
||||
code_other = ('dark red', 'default'),
|
||||
|
||||
warn = ('brown', 'default'),
|
||||
error = ('light red', 'default'),
|
||||
|
||||
header = ('dark cyan', 'default'),
|
||||
@ -166,6 +167,7 @@ class LowLight(Palette):
|
||||
code_other = ('light red', 'default'),
|
||||
|
||||
error = ('light red', 'default'),
|
||||
warn = ('brown', 'default'),
|
||||
|
||||
header = ('dark blue', 'default'),
|
||||
highlight = ('black,bold', 'default'),
|
||||
@ -250,6 +252,7 @@ class SolarizedLight(LowLight):
|
||||
code_other = (sol_magenta, 'default'),
|
||||
|
||||
error = (sol_red, 'default'),
|
||||
warn = (sol_orange, 'default'),
|
||||
|
||||
header = (sol_blue, 'default'),
|
||||
highlight = (sol_base01, 'default'),
|
||||
@ -299,6 +302,7 @@ class SolarizedDark(LowDark):
|
||||
code_other = (sol_magenta, 'default'),
|
||||
|
||||
error = (sol_red, 'default'),
|
||||
warn = (sol_orange, 'default'),
|
||||
|
||||
header = (sol_blue, 'default'),
|
||||
highlight = (sol_base01, 'default'),
|
||||
|
@ -89,6 +89,11 @@ class Master(object):
|
||||
mitmproxy_ctx.master = None
|
||||
mitmproxy_ctx.log = None
|
||||
|
||||
def add_event(self, e, level="info"):
|
||||
"""
|
||||
level: debug, info, warn, error
|
||||
"""
|
||||
|
||||
def add_server(self, server):
|
||||
# We give a Channel to the server which can be used to communicate with the master
|
||||
channel = Channel(self.event_queue, self.should_exit)
|
||||
|
@ -114,7 +114,7 @@ class DumpMaster(flow.FlowMaster):
|
||||
raise DumpError(str(e))
|
||||
|
||||
def add_event(self, e, level="info"):
|
||||
needed = dict(error=0, info=1, debug=2).get(level, 1)
|
||||
needed = dict(error=0, warn=1, info=2, debug=3).get(level, 2)
|
||||
if self.options.verbosity >= needed:
|
||||
self.echo(
|
||||
e,
|
||||
|
@ -52,11 +52,6 @@ class FlowMaster(controller.Master):
|
||||
port
|
||||
)
|
||||
|
||||
def add_event(self, e, level="info"):
|
||||
"""
|
||||
level: debug, info, error
|
||||
"""
|
||||
|
||||
def get_ignore_filter(self):
|
||||
return self.server.config.check_ignore.patterns
|
||||
|
||||
|
@ -30,7 +30,7 @@ class Options(options.Options):
|
||||
stickycookie=None, # type: Optional[str]
|
||||
stickyauth=None, # type: Optional[str]
|
||||
stream_large_bodies=None, # type: Optional[str]
|
||||
verbosity=1, # type: int
|
||||
verbosity=2, # type: int
|
||||
outfile=None, # type: Tuple[str, str]
|
||||
replay_ignore_content=False, # type: bool
|
||||
replay_ignore_params=(), # type: Sequence[str]
|
||||
|
Loading…
Reference in New Issue
Block a user