Forum Discussion

mathare's avatar
mathare
Contributor
13 years ago

Controlling what is written to log

Is it possible to control what is automatically written to the log generated when a (scripted) test is run?




For example, in addition to the log messages I have added in my code I get entries for events such as menu options being clicked, key presses and button clicks. Is there any way to turn these off by default?




I don't particularly want to filter my test logs to not show Event messages but if that's the only/easiest way then I will have to go down that route.




3 Replies

  • Hi Mat,

    I explore the log possibilities too.

    The solution I see to your question is that you may attribute to your "customized" log message a priority that differ from the usual priority level (see the priority property), ie that is not a 100 multiple.

    Add an event handler for the onLogEvent (see post indicated in this discussion) and  in the associated script, filter the event :



    if (LogParams["Priority"] mod 100 != 0) // the priority is customized

    {

        LogParams["Locked"] = true;  //the message is not added

    }




    When you will need to trace also your own log, set the value to false. That's it.



    Have a look in the TestLog Samples that may be usefull.



    Best,

    Christophe







      
  • That sounds like an excellent solution Christophe - thanks for that. I'll have a play with that and see how I get on.
  • sastowe's avatar
    sastowe
    Super Contributor
    Thanks to you both. That is a solution to my needs as well.