Skip to content

Commit 4542a2e

Browse files
committed
-v shows subprocess output
by setting only the subprocess log level to debug require -vv to enable full debug output
1 parent c1251a8 commit 4542a2e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

news/9447.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Require ``-vv`` for full debug-level output, ``-v`` now only enables showing subprocess output, e.g. of ``setup.py install``.

src/pip/_internal/utils/logging.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def setup_logging(verbosity, no_color, user_log_file):
246246
"""
247247

248248
# Determine the level to be logging at.
249-
if verbosity >= 1:
249+
if verbosity >= 2:
250250
level = "DEBUG"
251251
elif verbosity == -1:
252252
level = "WARNING"
@@ -256,6 +256,15 @@ def setup_logging(verbosity, no_color, user_log_file):
256256
level = "CRITICAL"
257257
else:
258258
level = "INFO"
259+
260+
if verbosity == 1:
261+
# verbosity 1 means only subprocess logging is debug-level
262+
# disabling capture of subprocess output
263+
subprocess_level = "DEBUG"
264+
subprocess_logger.setLevel(subprocess_level)
265+
else:
266+
subprocess_level = level
267+
259268

260269
level_number = getattr(logging, level)
261270

@@ -334,7 +343,7 @@ def setup_logging(verbosity, no_color, user_log_file):
334343
# A handler responsible for logging to the console messages
335344
# from the "subprocessor" logger.
336345
"console_subprocess": {
337-
"level": level,
346+
"level": subprocess_level,
338347
"class": handler_classes["stream"],
339348
"no_color": no_color,
340349
"stream": log_streams["stderr"],

0 commit comments

Comments
 (0)