Updated *Great Tricks to DEBUG with NSLog... DLog Prints Only when Breakpoints(DEBUG) present. ALog Prints Always.. ULog Shows a Alert View where it is located with view controller name & method name...
**** This will works when in Edit Scheme > Run > info > Build Configuration 1. Debug mode (Default) Prints DLog, ALog & ULog 2. In release mode Only ALog Prints..
1. Add Below Code in created .PCH File of your Project. i already said how to create .PCH File in my previous Post.
#define NSLog if(1) NSLog /* Useful for NSLog Prints for 1 & didn't print for 0 */
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#ifdef DEBUG
# define ULog(fmt, ...) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#else
# define ULog(...)
#endif
2.Now add Logs in your project wherever you want..
DLog Prints Only when Breakpoints(DEBUG) present.
DLog(@"hdhsk================== =======================>?>>>>> >>>");
ALog Prints Always..
ALog(@"ALOG,,dssl; fmklgjkfjgfgvdfgv");
ULog Shows a Alert View where it is located with view controller name & method name..
ULog(@"ULOG------------------- ---");
No comments:
Post a Comment