def configure_logging(info=False, debug=False):
"""Configure logging
The function configures log messages. By default, log messages
are sent to stderr. Set the parameter `debug` to activate the
debug mode.
:param debug: set the debug mode
"""
if info:
logging.basicConfig(level=logging.INFO,
format=LOG_FORMAT)
logging.getLogger('requests').setLevel(logging.WARNING)
logging.getLogger('urrlib3').setLevel(logging.WARNING)
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
elif debug:
logging.basicConfig(level=logging.DEBUG,
format=DEBUG_LOG_FORMAT)
else:
logging.basicConfig(level=logging.WARNING,
format=LOG_FORMAT)
logging.getLogger('requests').setLevel(logging.WARNING)
logging.getLogger('urrlib3').setLevel(logging.WARNING)
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
评论列表
文章目录