I wanted to override the existing NSLog mechanism.
NSLog should have different modes.NSLOG(, " Description"); can be numbers from 1, 2 or 3 to indicate whether the loglevel is CRITICAL, MAJOR or MINOR.
If the loglevel = 1, I want Overridden NSLOG along with function name and line number.
Why Printing i=5 is not getting Printed in below sample code? How to fix this?
#define NSLog(loglevel, ...) \
if(loglevel == 1) \
NSLog( @"%s [Line %d] %s", __PRETTY_FUNCTION__, __LINE__,
##__VA_ARGS__);
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSLog(1,"Hello how r u");
int i=5;
NSLog(1,"Printing i=%d", i);
return YES;
}
OUTPUT
[AppDelegate application:didFinishLaunchingWithOptions:] [Line 32] Hello how r u 2017-04-06 18:15:17.303 LogLevel[3620:160181] -[AppDelegate application:didFinishLaunchingWithOptions:] [Line 34] Printing i=%d