On Feb 24, 2012, at 3:58 PM, J. Landman Gay wrote:

> On 2/24/12 1:55 PM, Dar Scott wrote:
> 
>> I suspect we are all doing this the wrong way.  Maybe there are
>> debugging features or compiler optimizations that allow for better
>> ways to do this.
> 
> I've started doing it the way someone else suggested. I use a handler:
> 
> on log pMsg
> put pMsg
> end log
> 
> Then in the scripts:
> 
> LOG "Message about script performance."
> 
> When I want to stop logging, I just comment out the one-line body of the 
> handler. If I really want to remove it all, I search for "LOG " (with space.)
> 
> I don't know of any native LiveCode way to do it.

We could streamline this. Put in a frontscript:

global pmbLogging -- I'm using my initials as a prefix

on startup
   put false into pmbLogging
   pass startup
end startup

private command startLogging
   put true into pmbLogging
end startLogging

private command stopLogging
   put false into pmbLogging
end stop Logging

Then in your scripts, when you want to log something:

on log pMsg
   global pmbLogging
   if not pmbLogging then exit log
   put pMsg
end log

Then you don't have to search for anything in any script to comment it out, 
just type "stoplogging" into the message box and hit return.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to