Is it true that one should not use NSLog() on production code?

Preprocessor macros are indeed great for debugging. There’s nothing wrong with NSLog(), but it’s simple to define your own logging function with better functionality. Here’s the one I use, it includes the file name and line number to make it easier to track down log statements. #define DEBUG_MODE #ifdef DEBUG_MODE #define DebugLog( s, … ) … Read more

How to print out the method name and line number and conditionally disable NSLog?

Here are some useful macros around NSLog I use a lot: #ifdef DEBUG # define DLog(fmt, …) NSLog((@”%s [Line %d] ” fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) #else # define DLog(…) #endif // ALog always displays output regardless of the DEBUG setting #define ALog(fmt, …) NSLog((@”%s [Line %d] ” fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) The DLog macro is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)