1
0
forked from clan/clan-core

don't register global logger, this interferes currently with that we have in ssh.py

This commit is contained in:
Jörg Thalheim 2023-10-04 08:06:11 +02:00
parent 4abb7d7bf0
commit 80e37483a3

View File

@ -1,15 +1,12 @@
import argparse
import logging
import sys
from types import ModuleType
from typing import Optional
from . import config, create, custom_logger, machines, secrets, vms, webui
from . import config, create, machines, secrets, vms, webui
from .errors import ClanError
from .ssh import cli as ssh_cli
log = logging.getLogger(__name__)
argcomplete: Optional[ModuleType] = None
try:
import argcomplete # type: ignore[no-redef]
@ -66,19 +63,12 @@ def main() -> None:
parser = create_parser()
args = parser.parse_args()
if args.debug:
custom_logger.register(logging.DEBUG)
log.debug("Debug logging enabled")
else:
custom_logger.register(logging.INFO)
if not hasattr(args, "func"):
log.error("No argparse function registered")
return
try:
args.func(args)
except ClanError as e:
log.exception(e)
print(e, file=sys.stderr)
sys.exit(1)