Return to Snippet

Revision: 19301
at October 20, 2009 22:51 by zingo


Initial Code
#define DetailedLog(str, args...) NSLog\
(@"\n-------------\nBetter Log\n%s:%d\n%@\n[%s]\n\n[%@]\n-------------\n",\
strrchr(__FILE__, '/'), __LINE__, self, sel_getName(_cmd),\
[NSString stringWithFormat:str , ## args ] )

// this function was improved to work in functions as well as methods:
#define DetailedLog(str, args...)\
NSLog(@"\n-------------\nBetter Log\n%s:%d\n%s\n\n[%@]\n-------------\n",\
strrchr(__FILE__, '/'), __LINE__, __PRETTY_FUNCTION__,\
[NSString stringWithFormat:str , ## args ] )

Initial URL
http://www.degutis.org/dev/2009/04/14/detailedlog/

Initial Description
Ever needed to see more context surrounding your NSLog statement to help you debug in the console?

Initial Title
Detailed NSLog() via a Preprocessor Macro

Initial Tags


Initial Language
Objective C