Page 1 of 1

console output from desktop livecode

Posted: Tue Jul 19, 2011 11:15 am
by pynadathraju
Please can any one tell me how to generate persistent console log

I am having some performance issues using images with livecode in IOS. The function below show the time between each profile in the message box
but the problem is it over write the previous profile - I'd like it to append to the end like usual console log output. How do I generate persistent console log?

command profile profileMessage
--local vars
local currentProfileTime

--get current time
put the milliseconds into currentProfileTime

--subtract PREVIOUS time from current time and set as since since last time
put currentProfileTime - lastProfileTime into timeSinceLastProfile

--**output the profile diagnostics**
--put message plus current time plus time since last time
put profileMessage & " : " & timeSinceLastProfile & return

--set the last profile time
put currentProfileTime into lastProfileTime
end profile

Re: console output from desktop livecode

Posted: Tue Jul 19, 2011 11:57 am
by Klaus
Hi pynadathraju,

at first some hints::
PROFILE might be a reserved word and should not be used as the name of a handler or something!

-> put X INTO Y
will of course OVERWRITE the contents of Y everytime!
So you should use:
-> put CR & X AFTER Y
How do I generate persistent console log?
A LOG is nothing but a lot of informative TEXT, so you have a lot of options:
1. Use (hidden) field to store your info:
put CR & yourDataHere AFTER fld "your field here"

2. Use a global or local variable, whatever fits your needs:
global tVariable
## local tVariable
put CR & YourDataHere AFTER tVariable

3. Write directly o a file on disk:
put CR & yourDataHere AFTER URL("file:" & "path/to/file/here/mylog.txt")

Hope that helps!

And welcome to the forum! :D


Best

Klaus

P.S.
LiveCode is DIFFERENT, as you might have noticed. 8)
Here are some very good learning resources, please take a look:
http://www.runrev.com/developers/lesson ... nferences/

Re: console output from desktop livecode

Posted: Tue Jul 19, 2011 1:58 pm
by BvG
Note that all screen-udates are very slow. If you update the message box even twice per second, it will slow down your code execution considerably. Make sure to not update fields or the message box too often when doing logging.

Re: console output from desktop livecode

Posted: Tue Jul 19, 2011 2:14 pm
by pynadathraju
Hi Klaus,
Thanks for the resources. Let me have a look at it