mirror of
https://github.com/isjerryxiao/pacroller.git
synced 2024-11-15 04:42:24 +08:00
release v0.1.5
fix logging issue
This commit is contained in:
parent
6330ba1a06
commit
bc69d010e5
2 changed files with 6 additions and 5 deletions
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="pacroller",
|
name="pacroller",
|
||||||
version="0.1.4",
|
version="0.1.5",
|
||||||
author="Jerry Xiao",
|
author="Jerry Xiao",
|
||||||
author_email="pacroller@mail.jerryxiao.cc",
|
author_email="pacroller@mail.jerryxiao.cc",
|
||||||
description="unattended upgrade for archlinux",
|
description="unattended upgrade for archlinux",
|
||||||
|
|
|
@ -272,10 +272,11 @@ def main() -> None:
|
||||||
default='auto', help='allow interactive questions',
|
default='auto', help='allow interactive questions',
|
||||||
metavar="auto / on / off ")
|
metavar="auto / on / off ")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.debug:
|
_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='%(asctime)s - %(module)s - %(funcName)s - %(levelname)s - %(message)s')
|
logging.basicConfig(level=logging.DEBUG, format=_log_format)
|
||||||
else:
|
if not args.debug:
|
||||||
logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s')
|
assert len(logger.handlers) == 1
|
||||||
|
logger.handlers[0].setLevel(logging.INFO)
|
||||||
locale_set()
|
locale_set()
|
||||||
interactive = args.interactive == "on" or not (args.interactive == 'off' or not isatty(0))
|
interactive = args.interactive == "on" or not (args.interactive == 'off' or not isatty(0))
|
||||||
logger.debug(f"interactive questions {'enabled' if interactive else 'disabled'}")
|
logger.debug(f"interactive questions {'enabled' if interactive else 'disabled'}")
|
||||||
|
|
Loading…
Reference in a new issue