Skip to content

Commit d653e65

Browse files
committed
fixup! Restore colors in regular logging messages
1 parent 96b0ab1 commit d653e65

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/pip/_internal/utils/logging.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ def emit(self, record: logging.LogRecord) -> None:
162162
else:
163163
message = self.format(record)
164164
renderable = self.render_message(record, message)
165-
if record.levelno >= logging.ERROR:
166-
style = Style(color="red")
167-
elif record.levelno >= logging.WARNING:
168-
style = Style(color="yellow")
165+
if record.levelno is not None:
166+
if record.levelno >= logging.ERROR:
167+
style = Style(color="red")
168+
elif record.levelno >= logging.WARNING:
169+
style = Style(color="yellow")
170+
169171
try:
170172
self.console.print(renderable, overflow="ignore", crop=False, style=style)
171173
except Exception:

0 commit comments

Comments
 (0)