Error("blah blah blah") not showing in RED color
by Arcanor · in Torsion · 10/24/2007 (5:16 am) · 4 replies
I'm running v1.1.130 beta.
I usually run my game from inside Torsion so that I can see the server console output. However, as pointed out in other threads here, this error output is sometimes hard to navigate because of the large volume of other stuff in the log. So I added some code like this to my scripts:
If I view the log from inside my game client the output is correctly in RED. However when I view the Output pane inside Torsion I see the text, but it's printed in BLACK, and there's no red stripe on the right sidebar to help me find my tagged output.
Why doesn't error() output display in RED when viewed from the Torsion Output pane? Is this something that will be fixed in a future release? Or is there a workaround or configuration change I can make which will allow me to see the colors correctly from inside Torsion?
I've also changed some of the engine-based error messages from warnf() to errorf(). These are showing up in black in Torsion as well (but red in the in-game console). For example, I changed the "missing file" warning to an error, but it's still no easier to find from inside Torsion.
Thanks in advance.
I usually run my game from inside Torsion so that I can see the server console output. However, as pointed out in other threads here, this error output is sometimes hard to navigate because of the large volume of other stuff in the log. So I added some code like this to my scripts:
error("Sample error text. This should be displayed in RED in the log output.");If I view the log from inside my game client the output is correctly in RED. However when I view the Output pane inside Torsion I see the text, but it's printed in BLACK, and there's no red stripe on the right sidebar to help me find my tagged output.
Why doesn't error() output display in RED when viewed from the Torsion Output pane? Is this something that will be fixed in a future release? Or is there a workaround or configuration change I can make which will allow me to see the colors correctly from inside Torsion?
I've also changed some of the engine-based error messages from warnf() to errorf(). These are showing up in black in Torsion as well (but red in the in-game console). For example, I changed the "missing file" warning to an error, but it's still no easier to find from inside Torsion.
Thanks in advance.
About the author
www.arcanoria.com
#2
Note how the pattern is very similar to VC++ errors.
If the error() script command automatically added the script file and line when outputting then it would just work... but so far it hasn't been changed.
I don't have the time to tackle this. But if someone submits the fix as a resource for TGE/TGB/TGEA and it proves to not cause too much havoc with existing code, i bet GG will include it into the next release.
10/27/2007 (1:01 pm)
The issue is that the colors are not part of the output stream sent from the TelnetDebugger and really the probably shouldn't be. Do you think that command line VC++ compiler outputs color data as part of the build output? No... the VC++ ide, like Torsion, parses the output and identifies certain patterns as errors. Torsion looks for the following patterns:C:/Projects/MyProject/example/game/client/gui/menu.gui Line: 19 - SOME ERROR! C:/Projects/MyProject/example/game/client/gui/menu.gui (19): SOME WARNING!
Note how the pattern is very similar to VC++ errors.
If the error() script command automatically added the script file and line when outputting then it would just work... but so far it hasn't been changed.
I don't have the time to tackle this. But if someone submits the fix as a resource for TGE/TGB/TGEA and it proves to not cause too much havoc with existing code, i bet GG will include it into the next release.
#3
Is it possible to add a new feature to Torsion to allow changes to logfile output text (color, bold, underline, italic) via escape sequences that are intended specifically for Torsion to process?
Maybe something like this:
1. whenever a string "[[red]]" is at the beginning of a line, display that line in red, then revert to normal for the next line
2. similar for other possible colors, like "[[blue]]", "[[green]]", etc.
3. similar for other font attributes like "[[bold]]", "[[underline]]", "[[italic]]" (maybe this is impractical?)
12/04/2007 (5:58 am)
Sometimes I may want to highlight something I've written to the logfile that isn't an error associated with a specific filename and line.Is it possible to add a new feature to Torsion to allow changes to logfile output text (color, bold, underline, italic) via escape sequences that are intended specifically for Torsion to process?
Maybe something like this:
1. whenever a string "[[red]]" is at the beginning of a line, display that line in red, then revert to normal for the next line
2. similar for other possible colors, like "[[blue]]", "[[green]]", etc.
3. similar for other font attributes like "[[bold]]", "[[underline]]", "[[italic]]" (maybe this is impractical?)
#4
Here's the code, which I put into _printf() in console.cpp around line 524. Replace this:
Again, this is nothing more than a hack! Use at your own risk.
12/04/2007 (6:39 am)
If anyone is interested, I've made a small TGEA engine hack to highlight any warnf() or errorf() output, based on Torsion's pattern scanning algorithm, as Tom mentioned above. I'm simply prepending a string to the output, either " (1): " for a warnf, or " (2): " for an errorf.Here's the code, which I put into _printf() in console.cpp around line 524. Replace this:
char buffer[4096];
U32 offset = 0;
if(gEvalState.traceOn && gEvalState.stack.size())
{
offset = gEvalState.stack.size() * 3;
for(U32 i = 0; i < offset; i++)
buffer[i] = ' ';
}
if (useTimestamp)
{
...with this:char buffer[4096];
U32 offset = 0;
if(gEvalState.traceOn && gEvalState.stack.size())
{
offset = gEvalState.stack.size() * 3;
for(U32 i = 0; i < offset; i++)
buffer[i] = ' ';
}
if (level != ConsoleLogEntry::Normal)
{
offset += dSprintf(buffer + offset, sizeof(buffer) - offset, " (%d): ", level);
dVsprintf(buffer + offset, sizeof(buffer) - offset, fmt, argptr);
}
if (useTimestamp)
{
...This should have the effect of tricking Torsion's error detection code into finding an error, which will then be displayed in RED.Again, this is nothing more than a hack! Use at your own risk.
Torque Owner James Terry
Missing exec files, which show up gray in the console don't show up as red error text in Torsion, but the error text from an incorrectly called command will trigger error text to show up in red in Torsion
It would very nice for Torsion's output window to maintain text colors from (or similar to) the console. warn() and error() do not look different in Torsion, just black text with no error highlighting.