这对你有用吗?
import logging lvl = logging.INFO logging.basicConfig(filename='example.log',level=lvl) print(logging.getLevelName(lvl)) >>>INFO