Sub Trace(Value as string)
if m.Development=true print (stri(m.Timer.TotalMilliseconds())+": "+Value)
End Sub
Then I can call it anytime and it prints if in dev, the drawback is if I do a complex function to generate the value, it still runs in production, but the one area I do that I surrounded with the same m.Development check.
“sjb64” wrote:
Instead of, but similar to, the printon setting, I use this and it works ok for me…
Well done, good sir!
I think i’ll ugh, borrow that for my code. There is actually already a timer somewhere - a bit obscure but i found it - in ifAppManager.
'main() init section. keep singletons handy
m.roAppManager = createObject("roAppManager")
m.roAppInfo = createObject("roAppInfo")
m.isSideLoaded = roAppInfo.isDev()
...
function trace(this, that = ""):
if m.isSideLoaded then
print m.roAppManager.getUptime(); ": "; this; that
end if
end function
An advantage of using semicolon separator instead of string concat is that this can now be any type (e.g. array, dictionary) and let print handle the printing