This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf/md_pdf/logging.py

18 lines
386 B
Python
Raw Normal View History

2017-04-04 21:44:17 +01:00
import logging
from md_pdf.utils import safe_list_get
FORMAT = "[%(levelname)s]: %(message)s"
LOG_LEVELS = [
logging.WARN,
logging.INFO,
logging.DEBUG,
logging.NOTSET
]
def set_verbosity(args):
level = min(args.verbose, len(LOG_LEVELS) - 1)
verbosity = safe_list_get(LOG_LEVELS, level, logging.NOTSET)
logging.basicConfig(format=FORMAT, level=verbosity)