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
2017-04-05 13:43:47 +01:00

17 lines
386 B
Python

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)