Stray Puts
Peter M. Brigham, MD
pmbrig at gmail.com
Sat Feb 25 09:09:23 EST 2012
I see I'm behind the curve again, should have read the rest of the thread before posting...
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
On 2/25/11, Peter Brigham wrote:
> 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
>
> <snip>
On Feb 24, 2012, at 5:22 PM, Andre Garzia wrote:
> On Fri, Feb 24, 2012 at 7:55 PM, Dar Scott <dsc at swcp.com> wrote:
>
>> Is there any advantage of using a debug constant over commenting out the
>> body of the log?
>
>
> no advantage at all... actually, the commented version will run faster
> because it does not execute the if statement to check for constant value.
> The thing about constants is that you can script your log function to
> behave differently depending on the constant value such as:
>
> constant kDebug = "msg"
>
> on log pText
> switch kDebug
> case "msg"
> put pText
> break
> case "file"
> put pText & cr after url ("file:" && the effective filename of this
> stack & ".log")
> break
> end switch
> end log
>
> Then you have added benefits...
More information about the use-livecode
mailing list