Open waldnercharles opened 1 year ago
__print_line_rich()
seems to have a code that replaces BBCode with ANSI escapes.
https://github.com/godotengine/godot/blob/0032c1c0c203ba225dd41bdc799f2e622bccfde5/core/string/print_string.cpp#L88-L98
Maybe the condition disables it for files? Not sure what's the more expected behavior though.
print_line_rich()
should contain a isatty(fileno(stdout))
check. If false
(which indicates a non-interactive scenario such as writing stdout to a file), use print_line()
.
This is a UNIX API; I'm not sure what the Windows API equivalent of this is. (We use ANSI escape codes on Windows too when using print_line_rich()
, as this is supported on Windows 10 and later.)
Godot version
v4.0.2.stable.mono.official [7a0977ce2]
System information
Windows 10
Issue description
I've been toying around with rich text logging on Windows and noticed that the added escape codes are being logged in the log files as well.
Ideally I believe these shouldn't exist in the log files.
Steps to reproduce
Project Settings > General > Debug > File Logging > Enable File Logging
GD.PrintRich("[color=green]Hello World[/color]");
%appdata%/Godot/app_userdata/your_project/godot.log
Minimal reproduction project
N/A