Example #1
0
 def format(self, record):
     # Handle custom log level names
     if record.levelno == LOG_ALL:
         levelname = "ALL"
     elif record.levelno == LOG_DATA:
         levelname = "DATA"
     elif record.levelno == LOG_CACHE:
         levelname = "CACHE"
     else:
         levelname = record.levelname
     # Map log level to appropriate color
     try:
         colour = Logging.COLORS[record.levelno]
     except KeyError:
         colour = "black"
     # Color the log level, use brackets when coloring off
     if Coloring().enabled():
         level = color(" " + levelname + " ", "lightwhite", colour)
     else:
         level = "[{0}]".format(levelname)
     return "{0} {1}".format(level, record.getMessage())
Example #2
0
 def shortname(self):
     """ Short same-width status string (4 chars) """
     return color(self._name[0:4],
                  color=self._colors[self.id],
                  enabled=config.Coloring().enabled())
Example #3
0
 def name(self):
     """ Human readable status name """
     return color(self._name,
                  color=self._colors[self.id],
                  enabled=config.Coloring().enabled())