Objective C macro - logging wrapper
As we know logging in Objective C is using
NSLog. The problem here
is I want to enable & disable the logging by changing a flag, NOT
NSLog when don't want to see the log; add
NSLog when want to
see the log.
There is a solution, which is CocoaLumberjack. However, I just want to see the message in console, don't want such a huch package.
Thus I choose to use macro.
Let's add the macro in Prefix.pch
// 1. the debug flag
// 2. the NSLog wrapper
- I can now turn on or off (by changing the value to
NO) at anytime
- The usage is exactly same as
JSLog(@"error %@", error);