summaryrefslogtreecommitdiff
path: root/logging_ext.py
diff options
context:
space:
mode:
authorJulien Jehannet <julien.jehannet@logilab.fr>2008-10-13 20:00:36 +0200
committerJulien Jehannet <julien.jehannet@logilab.fr>2008-10-13 20:00:36 +0200
commitbafc1843f598db1d4869aa1e574891c48720a05e (patch)
tree5a76054b0c8a4874585a953fd082e15add02f48b /logging_ext.py
parent756572f6e2ee9fa4bbcf622b0423ed352380c3d6 (diff)
downloadlogilab-common-bafc1843f598db1d4869aa1e574891c48720a05e.tar.gz
add a DEBUG color to our ColorFormatter. Feel free to change the color
Diffstat (limited to 'logging_ext.py')
-rw-r--r--logging_ext.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/logging_ext.py b/logging_ext.py
index 0012f0b..b788c00 100644
--- a/logging_ext.py
+++ b/logging_ext.py
@@ -20,8 +20,8 @@ class ColorFormatter(logging.Formatter):
"""
A color Formatter for the logging standard module.
- By default, colorize CRITICAL and ERROR in red, WARNING in orange
- and INFO in yellow.
+ By default, colorize CRITICAL and ERROR in red, WARNING in orange, INFO in
+ green and DEBUG in yellow.
self.colors is customizable via the 'color' constructor argument (dictionnary).
@@ -35,12 +35,13 @@ class ColorFormatter(logging.Formatter):
self.colors = {'CRITICAL': 'red',
'ERROR': 'red',
'WARNING': 'magenta',
- 'INFO': 'yellow',
+ 'INFO': 'green',
+ 'DEBUG': 'yellow',
}
if colors is not None:
assert isinstance(colors, dict)
- self.colors.update(colors)
-
+ self.colors.update(colors)
+
def format(self, record):
msg = logging.Formatter.format(self, record)
if record.levelname in self.colors: