Skip to content

Commit

Permalink
Set log level in subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
tothtamas28 committed Aug 21, 2024
1 parent 4f49117 commit 48b57f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyk/src/pyk/kdist/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@

def main() -> None:
args = _parse_arguments()
log_level = loglevel(args)

logging.basicConfig(level=loglevel(args), format=LOG_FORMAT)
logging.basicConfig(level=log_level, format=LOG_FORMAT)

if args.command == 'build':
_exec_build(**vars(args))
_exec_build(log_level=log_level, **vars(args))

elif args.command == 'clean':
_exec_clean(args.target)
Expand All @@ -45,6 +46,7 @@ def _exec_build(
targets: list[str],
args: list[str],
jobs: int,
log_level: int,
force: bool,
verbose: bool,
debug: bool,
Expand All @@ -54,6 +56,7 @@ def _exec_build(
target_ids=_process_targets(targets),
args=_process_args(args),
jobs=jobs,
log_level=log_level,
force=force,
verbose=verbose or debug,
clean=clean,
Expand Down
6 changes: 6 additions & 0 deletions pyk/src/pyk/kdist/_kdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from . import utils
from ._cache import target_cache
from .api import TargetId
from .utils import LOG_FORMAT

if TYPE_CHECKING:
from collections.abc import Iterable, Iterator, Mapping
Expand Down Expand Up @@ -85,6 +86,7 @@ def build(
*,
args: Mapping[str, str] | None = None,
jobs: int = 1,
log_level: int = logging.WARNING,
force: bool = False,
verbose: bool = False,
clean: bool = True,
Expand All @@ -108,6 +110,7 @@ def submit(target_id: TargetId) -> None:
self._build_target,
target_id=target_id,
args=args,
log_level=log_level,
force=force,
verbose=verbose,
clean=clean,
Expand Down Expand Up @@ -135,10 +138,13 @@ def _build_target(
target_id: TargetId,
args: dict[str, Any],
*,
log_level: int,
force: bool,
verbose: bool,
clean: bool,
) -> Path:
logging.basicConfig(level=log_level, format=LOG_FORMAT)

target = target_cache().resolve(target_id)
output_dir = self._target_dir(target_id)
manifest_file = self._manifest_file(target_id)
Expand Down

0 comments on commit 48b57f5

Please sign in to comment.