Hi All,
I have been using a global define for NSLog so I can turn debug logging on and off in one place. I put it in the prefix file usually if there is logging across many class files. Is there any way to do this with ASOC script files, and the regular log command, for instance. I know I can create a log handler with an on/off script property for a particular file but it would be nice to have a central “switch.” I’ve been messing around with this but can’t get anywhere. I guess it’s the old global property question.
#define LOGGING_ON
#ifdef LOGGING_ON
#define LOG_TEXT( a ) NSLog( a )
#else
#define LOG_TEXT( a ) // (a)
#endif
Well If you want it in a handler you don’t need the if statement. Comment and uncomment the log line, this way you avoid the overhead of if statements.
on logSomething_(somedata)
if aBoolean then
log somedata
end
end
and then I have a global boolean that is “aBoolean” and if true, it logs, if false it won’t. But then no commenting of code needs to happen anywhere, and I can put as many statements in my code. I set up a menu item to set aBoolean to true or false.