Forum Discussion
// Edit log messages
function CorrectRGBComponent(component)
{
component = aqConvert.VarToInt(component);
if (component < 0)
component = 0;
else
if (component > 255)
component = 255;
return component;
}
function RGB(r, g, b)
{
r = CorrectRGBComponent(r);
g = CorrectRGBComponent(g);
b = CorrectRGBComponent(b);
return r | (g << 8) | (b << 16);
}
function Pass(Msg)
{
var Attr;
Attr = Log.CreateNewAttributes();
Attr.FontColor = RGB(22, 20, 23);
Attr.BackColor = RGB(170, 227, 162);
// Passes the LogAttributes object to the Message function
Log.Message("PASS - " + Msg, "", pmNormal, Attr);
}
// Update the log file with the FAIL info and clore it red
function Fail(Msg)
{
var Attr;
Attr = Log.CreateNewAttributes();
Attr.FontColor = RGB(251, 251, 251);
Attr.BackColor = RGB(221, 33, 60);
// Passes the LogAttributes object to the Message function
Log.Error("FAIL - " + Msg, "", pmNormal, Attr);
}
function Information(Msg)
{
var Attr;
Attr = Log.CreateNewAttributes();
Attr.FontColor = RGB(22, 20, 23);
Attr.BackColor = RGB(197, 197, 198);
// Passes the LogAttributes object to the Message function
Log.Message("INFORMATION - " + Msg, "", pmNormal, Attr);
}
Looks awesome. Can you give an example on how to use this? I tried running the code but get multiple compilation errors.
- OV7 years agoFrequent Contributor
Hi,
just call the required function when ever you need it in the code and then after the script ends running look at the report, the background of the report line where you called the function should be in the color in the color you defined in the functionFor displaying the text you've sent to the function, that can help you "mark" areas in the report file with different colors so it'll be easier for whoever read the report to trace relevant data.
example:
Information("Test information Bgcolor")
Dont forget you'll need to use USEUNIT to include the use of the function/s you're calling to
Hope that helps,
Ofer
Related Content
- 5 years ago
- 3 years ago
- 2 years ago
Recent Discussions
- 18 days ago