aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/log.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-04-27 19:08:01 +1200
committerAldo Cortesi <aldo@nullcube.com>2017-04-27 19:08:01 +1200
commit218e127e749cf533a6410c2905b22cc88321c935 (patch)
tree8f8b80724b80395969dd48ae621c30f6d707d312 /mitmproxy/log.py
parentfde1159ae306be2db9c40db1de9e2f24286de8b9 (diff)
downloadmitmproxy-218e127e749cf533a6410c2905b22cc88321c935.tar.gz
mitmproxy-218e127e749cf533a6410c2905b22cc88321c935.tar.bz2
mitmproxy-218e127e749cf533a6410c2905b22cc88321c935.zip
Add an "alert" log level.
This has the same urgency as "info", but also signals to interactive tools that the user's attention should be drawn to the output, even if they're not looking at the event log. In the console app, this means the message appears in the status bar with a timeout.
Diffstat (limited to 'mitmproxy/log.py')
-rw-r--r--mitmproxy/log.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/mitmproxy/log.py b/mitmproxy/log.py
index c2456cf1..a2e7ea99 100644
--- a/mitmproxy/log.py
+++ b/mitmproxy/log.py
@@ -24,6 +24,15 @@ class Log:
"""
self(txt, "info")
+ def alert(self, txt):
+ """
+ Log with level alert. Alerts have the same urgency as info, but
+ signals to interctive tools that the user's attention should be
+ drawn to the output even if they're not currently looking at the
+ event log.
+ """
+ self(txt, "alert")
+
def warn(self, txt):
"""
Log with level warn.
@@ -41,4 +50,4 @@ class Log:
def log_tier(level):
- return dict(error=0, warn=1, info=2, debug=3).get(level)
+ return dict(error=0, warn=1, info=2, alert=2, debug=3).get(level)