Hey, here is a quick code snippet on how to customise your own NSLog.
Your Own Named NSLog:
Code:
#define iSDKLog(s, ...) NSLog(@"%@", [NSString stringWithFormat:(s)])
You can use it by doing this:
Code:
iSDKLog(@"Hello World");
If you use this function, it returns this in console:
Your Own Named NSLog showing the method you NSLog'ed :
Code:
#define iSDKMethodLog(fmt, ...) NSLog((@"%s" fmt), __PRETTY_FUNCTION__);
That returns this in console:
Code:
-[Music_ChartsAppDelegate application:didFinishLaunchingWithOptions:]hello world
Your own named NSLog showing the line name:
Code:
#define iSDKLineLog(fmt, ...) NSLog((@" [Line %d] " fmt),__LINE__, ##__VA_ARGS__);
That returns this in console:
Code:
[Line 27] hello world
and finally: Your own named NSLog showing the line and method name:
Code:
#define iSDKMethodAndLineLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
That returns this in console:
Code:
-[Music_ChartsAppDelegate application:didFinishLaunchingWithOptions:] [Line 26] hello world
Hope this helps you debug your projects!!