Configurable Rendering Format (LogRender) #2534
Unanswered
AndreasBackx
asked this question in
Ideas
Replies: 1 comment 7 replies
-
|
This would shift the burden to the Rich, but the functionality belongs in the application's code. Don't rely on |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
-
This follows #2520, it was a PR to implement the
consoleparameter inrich.reconfigureas it was added but never implemented. The PR was closed as it would not be the ideal solution, the conversation hopefully can continue here. 🙂The premise is that we have a internal libraries to simplify and standardise many parts of a CLI. An example is for
stderrto be the default instead ofstdout. This is achievable with the current implementation ofrich.reconfigure. However, we additionally want to change the format of messages/renderables. This is currently controlled by a private_log_render.LogRender. If this is to be configured,Consoleneeds to be subclassed and changed to "fake"LogRenderwhich is not ideal. I propose something along the lines below to perhaps make this configurable? This is just an idea, I thought that would hopefully get the conversation started.LogRenderer(Protocol[LogRenderOptions], ConsoleRenderable)to replaceLogRender. This would determine how a particular "log" is rendered.Logto contain all of the information that needs to be logged. Making it a dataclass allows us to add fields in the future without breaking compatibility.TableLogRenderOptionswith the same implementation as the currentLogRenderand replace it inConsole.This will allow custom formatting via
LogRendererand allow tweaking as well asLogRenderOptionsis configurable from theConsolelevel.There also have been some other discussions and issues that want to change the format of Rich. These could be made possible with a custom renderer, whether they write that themselves, the default one is updated, or multiple renderers are included in Rich by default.
Let me know what you think. How would you tackle it or have you thought about this in the past? 😊
Beta Was this translation helpful? Give feedback.
All reactions