Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Add to any Python script to make logging fun and easy to look at
- def color_code(code): return '\x1b[%sm' % code
- def colorize(code, s): return '%s%s%s' % (
- color_code(code), str(s).replace(color_code(0), color_code(code)), color_code(0))
- def green(s): return colorize(32, s)
- def yellow(s): return colorize(33, s)
- def red(s): return colorize('1;31', s)
- def cyan(s): return colorize(36, s)
- def magenta(s): return colorize(35, s)
- def info_log(s): print yellow(s)
- def success_log(s): print green(s)
- def error_log(s): print red(s)
- def debug_log(s):
- if DEBUG: print "%s%s" % (magenta('DEBUG: '), yellow(s))
Add Comment
Please, Sign In to add comment