Forum Discussion
esramirez
13 years agoContributor
You can create your own library to log messages/errors. For example,
Create a script called 'Logger' and a function called ErrorMessage(strMsg, sourceOfError,Priority)
{
if(!priority)
priority = 100; //default value
if(priority>300)
{
throw new error(666,sourceOfError + " says:" + strMsg);
}
}
And from within your test
function testMyTestase()
{
try
{
//do something
if (somethingDidnotwork)
{
Logger.Error("Oops, better luck next time", testMyTestase,3000)
}
catch(e)
{
Log.Error(e.description); //this will print 'testMyTestase says Oops, better luck next time'
}
finally
{
//optional - incase you want to clean up
}
}
Create a script called 'Logger' and a function called ErrorMessage(strMsg, sourceOfError,Priority)
{
if(!priority)
priority = 100; //default value
if(priority>300)
{
throw new error(666,sourceOfError + " says:" + strMsg);
}
}
And from within your test
function testMyTestase()
{
try
{
//do something
if (somethingDidnotwork)
{
Logger.Error("Oops, better luck next time", testMyTestase,3000)
}
catch(e)
{
Log.Error(e.description); //this will print 'testMyTestase says Oops, better luck next time'
}
finally
{
//optional - incase you want to clean up
}
}