Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/9447.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Require ``-vv`` for full debug-level output, ``-v`` now only enables showing subprocess output, e.g. of ``setup.py install``.
12 changes: 10 additions & 2 deletions src/pip/_internal/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def setup_logging(verbosity, no_color, user_log_file):
"""

# Determine the level to be logging at.
if verbosity >= 1:
if verbosity >= 2:
level = "DEBUG"
elif verbosity == -1:
level = "WARNING"
Expand All @@ -257,6 +257,14 @@ def setup_logging(verbosity, no_color, user_log_file):
else:
level = "INFO"

if verbosity == 1:
# verbosity 1 means only subprocess logging is debug-level
# disabling capture of subprocess output
subprocess_level = "DEBUG"
subprocess_logger.setLevel(subprocess_level)
else:
subprocess_level = level

level_number = getattr(logging, level)

# The "root" logger should match the "console" level *unless* we also need
Expand Down Expand Up @@ -334,7 +342,7 @@ def setup_logging(verbosity, no_color, user_log_file):
# A handler responsible for logging to the console messages
# from the "subprocessor" logger.
"console_subprocess": {
"level": level,
"level": subprocess_level,
"class": handler_classes["stream"],
"no_color": no_color,
"stream": log_streams["stderr"],
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_raise_broken_stdout__debug_logging(self, capsys):
"""
Test raising BrokenStdoutLoggingError with debug logging enabled.
"""
stderr = self.call_main(capsys, ['-v'])
stderr = self.call_main(capsys, ['-vv'])

assert 'ERROR: Pipe to stdout was broken' in stderr
assert 'Traceback (most recent call last):' in stderr
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_utils_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def prepare_call(self, caplog, log_level, command=None):
command = 'print("Hello"); print("world")'

caplog.set_level(log_level)
subprocess_logger.setLevel(log_level)
spinner = FakeSpinner()
args = [sys.executable, '-c', command]

Expand Down