Enabled logging DEBUG in pytest

This commit is contained in:
Qubasa
2024-01-11 22:14:55 +01:00
parent f7c6ab5888
commit 4d4c09da80
2 changed files with 6 additions and 4 deletions

View File

@@ -124,7 +124,8 @@ def main() -> None:
if args.debug:
setup_logging(logging.DEBUG)
log.debug("Debug log activated")
setup_logging(logging.INFO)
else:
setup_logging(logging.INFO)
if not hasattr(args, "func"):
return

View File

@@ -3,7 +3,7 @@ import logging
import shlex
from clan_cli import create_parser
from clan_cli.custom_logger import get_caller
from clan_cli.custom_logger import get_caller, setup_logging
log = logging.getLogger(__name__)
@@ -11,10 +11,11 @@ log = logging.getLogger(__name__)
class Cli:
def run(self, args: list[str]) -> argparse.Namespace:
parser = create_parser(prog="clan")
cmd = shlex.join(["clan", *args])
parsed = parser.parse_args(args)
setup_logging(logging.DEBUG)
cmd = shlex.join(["clan", "--debug", *args])
log.debug(f"$ {cmd}")
log.debug(f"Caller {get_caller()}")
parsed = parser.parse_args(args)
if hasattr(parsed, "func"):
parsed.func(parsed)
return parsed