mirror of
https://github.com/Textualize/rich.git
synced 2025-08-19 01:40:37 +00:00
Permit easy disabling of showing the path in the RichHandler logging handler.
This commit is contained in:
parent
66363d6709
commit
0178e83aa3
1 changed files with 3 additions and 1 deletions
|
@ -20,6 +20,7 @@ class RichHandler(Handler):
|
|||
level (int, optional): Log level. Defaults to logging.NOTSET.
|
||||
console (:class:`~rich.console.Console`, optional): Optional console instance to write logs.
|
||||
Default will create a new console writing to stderr.
|
||||
show_path (bool, optional): Show the path to the original logging message. Defaults to True.
|
||||
enable_link_path (bool, optional): Enable terminal link of path column to file. Defaults to True.
|
||||
|
||||
"""
|
||||
|
@ -41,12 +42,13 @@ class RichHandler(Handler):
|
|||
level: int = logging.NOTSET,
|
||||
console: Console = None,
|
||||
*,
|
||||
show_path: bool = True,
|
||||
enable_link_path: bool = True,
|
||||
) -> None:
|
||||
super().__init__(level=level)
|
||||
self.console = console or get_console()
|
||||
self.highlighter = self.HIGHLIGHTER_CLASS()
|
||||
self._log_render = LogRender(show_level=True)
|
||||
self._log_render = LogRender(show_level=True, show_path=show_path)
|
||||
self.enable_link_path = enable_link_path
|
||||
|
||||
def emit(self, record: LogRecord) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue