Enabled logging DEBUG in pytest
This commit is contained in:
@@ -124,6 +124,7 @@ def main() -> None:
|
|||||||
if args.debug:
|
if args.debug:
|
||||||
setup_logging(logging.DEBUG)
|
setup_logging(logging.DEBUG)
|
||||||
log.debug("Debug log activated")
|
log.debug("Debug log activated")
|
||||||
|
else:
|
||||||
setup_logging(logging.INFO)
|
setup_logging(logging.INFO)
|
||||||
|
|
||||||
if not hasattr(args, "func"):
|
if not hasattr(args, "func"):
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import logging
|
|||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from clan_cli import create_parser
|
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__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -11,10 +11,11 @@ log = logging.getLogger(__name__)
|
|||||||
class Cli:
|
class Cli:
|
||||||
def run(self, args: list[str]) -> argparse.Namespace:
|
def run(self, args: list[str]) -> argparse.Namespace:
|
||||||
parser = create_parser(prog="clan")
|
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"$ {cmd}")
|
||||||
log.debug(f"Caller {get_caller()}")
|
log.debug(f"Caller {get_caller()}")
|
||||||
parsed = parser.parse_args(args)
|
|
||||||
if hasattr(parsed, "func"):
|
if hasattr(parsed, "func"):
|
||||||
parsed.func(parsed)
|
parsed.func(parsed)
|
||||||
return parsed
|
return parsed
|
||||||
|
|||||||
Reference in New Issue
Block a user