Overridden method that applies SGR codes to log messages.

def format(self, record):
        """Overridden method that applies SGR codes to log messages."""
        # XXX: idea, colorize message arguments
        s = super(ANSIFormatter, self).format(record)
        if hasattr(self.context, 'ansi'):
            s = self.context.ansi(s, **self.get_sgr(record))
        return s