Skip to content

Commit

Permalink
Use rich handler for logging to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming committed Jun 24, 2022
1 parent 994c08e commit 1ef97c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pdm/termui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from rich.box import ROUNDED
from rich.console import Console
from rich.logging import RichHandler
from rich.progress import Progress, ProgressColumn
from rich.prompt import Confirm, IntPrompt, Prompt
from rich.table import Table
Expand Down Expand Up @@ -193,7 +194,9 @@ def logging(self, type_: str = "install") -> Iterator[logging.Logger]:
file_name = mktemp(".log", f"pdm-{type_}-")

if self.verbosity >= Verbosity.DETAIL:
handler: logging.Handler = logging.StreamHandler()
handler: logging.Handler = RichHandler(
console=_err_console, show_time=False, show_level=False, show_path=False
)
handler.setLevel(LOG_LEVELS[self.verbosity])
else:
handler = logging.FileHandler(file_name, encoding="utf-8")
Expand Down

0 comments on commit 1ef97c5

Please sign in to comment.