Ark2000 / PankuConsole

Feature-packed real-time debugging toolkit for Godot Engine.
https://k2kra.xyz/PankuConsole/
MIT License
944 stars 34 forks source link

Support print_rich() #133

Open qwitwa opened 9 months ago

qwitwa commented 9 months ago

Is your feature request related to a problem? Please describe. I want to see rich text output, but instead I see terminal escape codes

Describe the solution you'd like Rich text output displays in panku as in the terminal output

Example of terminal output using print_rich: image

How it appears inside of panku: image

Ark2000 commented 9 months ago

This appears to be a highly desired feature within our community.

At present, Panku directly accesses the output file produced by the Godot engine to retrieve all text passed to native Godot log functions like print, print_rich, push_error, etc. (really primitive, since godot does not provide proper logging utilities for external tools). This text is then displayed using a BBCode text component.

When print_rich outputs to standard output, it converts a supported subset of BBCode to ANSI escape codes, which the terminal emulator then displays.

To accurately capture the original BBCode string passed to print_rich, we need to create a wrapper function, such as panku_print_rich, to intercept the BBCode.

In summary, we should introduce a new log API to the Panku singleton to properly manage rich output.

This represents an excellent opportunity for contribution. I strongly encourage you to develop this feature and submit a pull request!

unfa commented 1 week ago

Yeah, I'm also experiencing this issue. I use BBcode to color my own logger's output, then it's ingested by Panku and it prints the ANSI codes (it applies the colors too): image