Skip to content

Instantly share code, notes, and snippets.

@prwhite
Created March 25, 2015 19:04
Show Gist options
  • Save prwhite/b95fe6154bd3d559eff2 to your computer and use it in GitHub Desktop.
Save prwhite/b95fe6154bd3d559eff2 to your computer and use it in GitHub Desktop.
Simple ObjC augmentation for NSLog to add file, line number and pretty function name. Compiles out in release (assuming DEBUG is not set in release)
#ifdef DEBUG
#define NSLogDebug(format, ...) \
NSLog(@"<%s:%d> %s, " format, \
strrchr("/" __FILE__, '/') + 1, __LINE__, __PRETTY_FUNCTION__, ## __VA_ARGS__)
#else
#define NSLogDebug(format, ...)
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment