Skip to content

Commit 4e7bc33

Browse files
committed
main: only output logs ment for the CLI
Signed-off-by: Filipe Laíns <[email protected]>
1 parent dba56c7 commit 4e7bc33

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/pkgconf/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919

2020
_LOGGER = logging.getLogger(__name__)
21+
_CLI_LOGGER = _LOGGER.getChild('cli')
2122

2223

2324
def _get_system_executable() -> Optional[pathlib.Path]:
@@ -89,8 +90,8 @@ def run_pkgconf(*args: str, **subprocess_kwargs: Any) -> subprocess.CompletedPro
8990
PKG_CONFIG_PATH = list(dict.fromkeys(PKG_CONFIG_PATH)) # Remove duplicated entried
9091
env['PKG_CONFIG_PATH'] = os.pathsep.join(PKG_CONFIG_PATH)
9192
cmd = [os.fspath(get_executable()), *args]
92-
_LOGGER.info('Running the Python pkgconf')
93-
_LOGGER.info('$ ' + shlex.join(('PKG_CONFIG_PATH=' + shlex.quote(env['PKG_CONFIG_PATH']), *cmd)))
93+
_CLI_LOGGER.info('Running the Python pkgconf')
94+
_CLI_LOGGER.info('$ ' + shlex.join(('PKG_CONFIG_PATH=' + shlex.quote(env['PKG_CONFIG_PATH']), *cmd)))
9495
return subprocess.run(cmd, env=env, **subprocess_kwargs)
9596

9697

src/pkgconf/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ def _setup_cli():
9999

100100
logging.basicConfig(
101101
stream=sys.stderr,
102-
format=f'{dim}> %(message)s{reset}',
103-
level=logging.INFO,
102+
format=f'{dim}> %(message)s{reset} [%(levelname)s:%(name)s]',
104103
)
104+
pkgconf._CLI_LOGGER.setLevel(logging.INFO)
105105

106106
def _showwarning(
107107
message: Union[Warning, str],

0 commit comments

Comments
 (0)