Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _color(self, level):
'''
Get a color (terminal escape sequence) according to a level.
'''
if not self._should_use_color():
return ''
elif level < Level.DEBUG:
return ''
elif Level.DEBUG <= level < Level.LOWINFO:
return Color.YELLOW
elif Level.LOWINFO <= level < Level.INFO:
return Color.BLUE
elif Level.INFO <= level < Level.WARNING:
return Color.GREEN
elif Level.WARNING <= level < Level.ERROR:
return Color.MAGENTA
elif Level.ERROR <= level:
return Color.RED
def error(self, message):
self.log(Level.ERROR, message)