aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-07-16 09:23:52 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-07-16 09:23:52 +1200
commit5a60f32c5510610935af1549022b3f7948002721 (patch)
treec3a33b820d01881474f68cde3293c473b95d0749
parent532ae7dc4acfd6082eca92d0daf7608f94c46232 (diff)
downloadmitmproxy-5a60f32c5510610935af1549022b3f7948002721.tar.gz
mitmproxy-5a60f32c5510610935af1549022b3f7948002721.tar.bz2
mitmproxy-5a60f32c5510610935af1549022b3f7948002721.zip
Fix log level handling
We have 4: error, warn, info and debug.
-rw-r--r--mitmproxy/cmdline.py2
-rw-r--r--mitmproxy/console/palettes.py6
-rw-r--r--mitmproxy/controller.py5
-rw-r--r--mitmproxy/dump.py2
-rw-r--r--mitmproxy/flow/master.py5
-rw-r--r--mitmproxy/flow/options.py2
6 files changed, 13 insertions, 9 deletions
diff --git a/mitmproxy/cmdline.py b/mitmproxy/cmdline.py
index 551fffa0..a29f58c6 100644
--- a/mitmproxy/cmdline.py
+++ b/mitmproxy/cmdline.py
@@ -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()
diff --git a/mitmproxy/console/palettes.py b/mitmproxy/console/palettes.py
index 36cc3ac0..2e12338f 100644
--- a/mitmproxy/console/palettes.py
+++ b/mitmproxy/console/palettes.py
@@ -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'),
diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py
index 503cdcd3..129691bb 100644
--- a/mitmproxy/controller.py
+++ b/mitmproxy/controller.py
@@ -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)
diff --git a/mitmproxy/dump.py b/mitmproxy/dump.py
index 999a709a..6a9bb951 100644
--- a/mitmproxy/dump.py
+++ b/mitmproxy/dump.py
@@ -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,
diff --git a/mitmproxy/flow/master.py b/mitmproxy/flow/master.py
index aa09e109..fe51c604 100644
--- a/mitmproxy/flow/master.py
+++ b/mitmproxy/flow/master.py
@@ -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
diff --git a/mitmproxy/flow/options.py b/mitmproxy/flow/options.py
index eccba5b1..6c2e3933 100644
--- a/mitmproxy/flow/options.py
+++ b/mitmproxy/flow/options.py
@@ -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]