Game Development Community

Console color tags introduce garbage into console.log file

by Richard Ranft · in Torque 3D Professional · 08/17/2011 (3:26 pm) · 3 replies

[code]
echo("\c4WeaponImage::onFire( WeaponImage:"@%this.getName()@", Client:"@%obj.client.nameBase@", Slot:"@%slot@" )");
echo("\c4WeaponImage::onFire - SourceObject:"@%obj@", SourceObject Client:"@%obj.client);
[\code]

drops

[code]
WeaponImage::onFire( WeaponImage:RocketLauncherImage, Client:Player9, Slot:0 )
WeaponImage::onFire - SourceObject:4449, SourceObject Client:4420
[\code]

into the log file. Um, in Notepad it is a pipe ( | ) character.

When I remove the color tags the | is no longer added in the log. In the console the text is colored as expected.

About the author

I was a soldier, then a computer technician, an electrician, a technical writer, game programmer, and now software test/tools developer. I've been a hobbyist programmer since the age of 13.


#1
08/17/2011 (3:29 pm)
Ok, MarkupLite doesn't like this post....
#2
08/17/2011 (3:44 pm)
That is because all raw text data passed to the logging functions will be saved into the console.log file. When you use \c# in a string in torqueScript it generates an ASCII control character plus one of the value and the GFXDrawUtil::drawTextN() function will look for those control characters to change the output text foreground color to the color array fontColors[#] declared in the associated control profile.
#3
08/17/2011 (4:08 pm)
Yeah, but they should strip it out when sending it anywhere but the console. It would be better, because who knows where else stuff like this isn't stripped when it should be.