From bafc1843f598db1d4869aa1e574891c48720a05e Mon Sep 17 00:00:00 2001 From: Julien Jehannet Date: Mon, 13 Oct 2008 20:00:36 +0200 Subject: add a DEBUG color to our ColorFormatter. Feel free to change the color --- logging_ext.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'logging_ext.py') 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: -- cgit v1.2.1