Skip to content

Instantly share code, notes, and snippets.

@rafaelbartolome
Created July 8, 2014 18:51
Show Gist options
  • Save rafaelbartolome/8982022f59c31dc4ab01 to your computer and use it in GitHub Desktop.
Save rafaelbartolome/8982022f59c31dc4ab01 to your computer and use it in GitHub Desktop.
NSLog helpers. DLog for debug, ELog for errors, ALog for alertview
//*********************************
#pragma mark LOGS
//*********************************
#define RBM_DEBUG
// DLog console log for debug
#ifdef RBM_DEBUG
#define DLog(fmt, ...) NSLog((@"%s[%d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(...)
#endif
// ELog console log for errors
#define ELog(fmt, ...) NSLog((@"%s[%d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
// ALog (alert view)
#ifdef RBM_DEBUG
#define ALog(fmt, ...) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [%d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#else
#define ALog(...)
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment