visualize_tree_5.py 836 B

1234567891011121314151617
  1. def init_logger(debug=False):
  2. """Sets up logging for this cli"""
  3. log_level = logging.DEBUG if debug else logging.INFO
  4. logging.basicConfig(format="%(levelname)s %(message)s\033[1;0m",
  5. stream=sys.stderr, level=log_level)
  6. logging.addLevelName(logging.CRITICAL,
  7. "\033[1;37m[\033[1;31mCRIT\033[1;37m]\033[0;31m")
  8. logging.addLevelName(logging.ERROR,
  9. "\033[1;37m[\033[1;33mERR \033[1;37m]\033[0;33m")
  10. logging.addLevelName(logging.WARNING,
  11. "\033[1;37m[\033[1;33mWARN\033[1;37m]\033[0;33m")
  12. logging.addLevelName(logging.INFO,
  13. "\033[1;37m[\033[1;32mINFO\033[1;37m]\033[0;37m")
  14. logging.addLevelName(logging.DEBUG,
  15. "\033[1;37m[\033[1;34mDBUG\033[1;37m]\033[0;34m")