Skip to content

Commit

Permalink
fixup! Restore colors in regular logging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Dec 5, 2021
1 parent 96b0ab1 commit d653e65
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pip/_internal/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@ def emit(self, record: logging.LogRecord) -> None:
else:
message = self.format(record)
renderable = self.render_message(record, message)
if record.levelno >= logging.ERROR:
style = Style(color="red")
elif record.levelno >= logging.WARNING:
style = Style(color="yellow")
if record.levelno is not None:
if record.levelno >= logging.ERROR:
style = Style(color="red")
elif record.levelno >= logging.WARNING:
style = Style(color="yellow")

try:
self.console.print(renderable, overflow="ignore", crop=False, style=style)
except Exception:
Expand Down

0 comments on commit d653e65

Please sign in to comment.