Skip to content

Instantly share code, notes, and snippets.

@MW3000
Created September 25, 2014 11:12
Show Gist options
  • Save MW3000/f2db4d76a7af2027ba73 to your computer and use it in GitHub Desktop.
Save MW3000/f2db4d76a7af2027ba73 to your computer and use it in GitHub Desktop.
Marcus Zarra’s logging macros.
// Marcus Zarra's logging macros.
#ifdef DEBUG
#define DLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#define DCLog(...) NSLog(@"%@", [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) {NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__]);[[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__];}
#else
#define DLog(...) do { } while (0)
#define DCLog(...) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
#endif
#define ALog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#endif
// End of Marcus Zarra's logging macros.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment