1234567891011121314151617 |
- def init_logger(debug=False):
- """Sets up logging for this cli"""
- log_level = logging.DEBUG if debug else logging.INFO
- logging.basicConfig(format="%(levelname)s %(message)s\033[1;0m",
- stream=sys.stderr, level=log_level)
- logging.addLevelName(logging.CRITICAL,
- "\033[1;37m[\033[1;31mCRIT\033[1;37m]\033[0;31m")
- logging.addLevelName(logging.ERROR,
- "\033[1;37m[\033[1;33mERR \033[1;37m]\033[0;33m")
- logging.addLevelName(logging.WARNING,
- "\033[1;37m[\033[1;33mWARN\033[1;37m]\033[0;33m")
- logging.addLevelName(logging.INFO,
- "\033[1;37m[\033[1;32mINFO\033[1;37m]\033[0;37m")
- logging.addLevelName(logging.DEBUG,
- "\033[1;37m[\033[1;34mDBUG\033[1;37m]\033[0;34m")
|