release v0.1.5

fix logging issue
This commit is contained in:
JerryXiao 2021-06-04 10:02:02 +08:00
parent 6330ba1a06
commit bc69d010e5
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5
2 changed files with 6 additions and 5 deletions

View file

@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="pacroller",
version="0.1.4",
version="0.1.5",
author="Jerry Xiao",
author_email="pacroller@mail.jerryxiao.cc",
description="unattended upgrade for archlinux",

View file

@ -272,10 +272,11 @@ def main() -> None:
default='auto', help='allow interactive questions',
metavar="auto / on / off ")
args = parser.parse_args()
if args.debug:
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(module)s - %(funcName)s - %(levelname)s - %(message)s')
else:
logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s')
_log_format = '%(asctime)s - %(module)s - %(funcName)s - %(levelname)s - %(message)s' if args.debug else '%(levelname)s - %(message)s'
logging.basicConfig(level=logging.DEBUG, format=_log_format)
if not args.debug:
assert len(logger.handlers) == 1
logger.handlers[0].setLevel(logging.INFO)
locale_set()
interactive = args.interactive == "on" or not (args.interactive == 'off' or not isatty(0))
logger.debug(f"interactive questions {'enabled' if interactive else 'disabled'}")