Everyone,
Sometimes, we wish to print console in our code for DEBUG mode only. Somehow, We also forget to remove that line from our code too at the time of execution of our product.
So, I found better solution which helps you to overcome this situation. Please keep below code in your common file and use it anywhere in your code or put it in .pch file of your project.
/******* Start Here ********/
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
/******* End Here ********/
**** For Example :
NSString *str = @"https://www.apple.com"
DLog(@"%@",str);
Console : https://www.apple.com
Regards,
Nilesh M. Prajapati