[REQUEST] A way to show the logger name when using RichHandler
See original GitHub issueHave you checked the issues for a similar suggestions? Yes.
How would you improve Rich?
I would add a way to show the logger name in RichHandler
. While you can use a logging.Formatter
that won’t allow you to have the logger name with some color. And enabling highlight
for all log messages is not really a feasible solution.
What problem does it solved for you?
It would allow me to show the logger name and have it colored with Rich.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
[REQUEST] A way to show the logger name when ... - GitHub
How would you improve Rich? I would add a way to show the logger name in RichHandler. While you can use a logging.Formatter...
Read more >Logging Handler — Rich 12.6.0 documentation
Here's an example of how to set up a rich logger: import logging from rich.logging import RichHandler FORMAT = "%(message)s" logging.
Read more >How to use custom log handler in pytest - Stack Overflow
RichHandler from the rich library to handle all captured logs in pytest. Say I have two files, # library.py import logging logger =...
Read more >Logging Cookbook — Python 3.11.1 documentation
StreamRequestHandler): """Handler for a streaming logging request. This basically logs the record using whatever logging policy is configured locally.
Read more >3. Logging — Level Up Your Python - GitHub Pages
But there is a better way, if you are willing to pay the (rather ugly) cost of ... Next we get a logger,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think there would be too many methods to satisfy everybody’s uses case. There’s four potential columns in the regular logger, that’s 4 methods to get their contents, and you would still need some way to configure the widths / alignment. What I was thinking of is a
render()
method which gives you complete control over how the logs are displayed.It’s not actually that hard to write a new renderer. It would only take a few lines to create a table with your desired columns.
The next version will have the
render
method and aget_message
method or something like it…See changes in 9.6.0 (just released)