Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.74 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Objective-C NSLog variant: __FILE__ without fullpath and output without datetime
  2. #ifdef DEBUG
  3.     #define DLog(...) NSLog(@"%@ %d %s %s", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, __PRETTY_FUNCTION__, __FUNCTION__)
  4.     #define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
  5. #else
  6.     #define DLog(...) do { } while (0)
  7.     #ifndef NS_BLOCK_ASSERTIONS
  8.         #define NS_BLOCK_ASSERTIONS
  9.     #endif
  10.     #define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
  11. #endif