def _validate(self, value):
"""
Parameters
----------
value : str
value to validate
"""
if (not hasattr(logging, value) or
type(getattr(logging, value)) is not int):
raise mm.ValidationError(
'{} is not a valid loglevel; try one of {}'.format(
value, LogLevel.options))
# Would prefer this to be an argparse.Action subclass, but not yet sure how to implement this way
logging.getLogger().setLevel(value)
评论列表
文章目录