Objective-C debug macros I'm looking for a review of my macros. I have these in the project pre-compile header. I tent to copy them into all my new projects as well, unless its a very simple project.

#ifdef __APPLE__
    #import &lt;TargetConditionals.h&gt;
#endif


// turn on or off different types of logging. ALog() is always logged.
#define LOG_D       // Turn on standard debug messages  DLog();
#define LOG_N       // Turn on network debug messages   NLog();
#define LOG_DB      // Turn on database debug messages  DBLog();
#undef  LOG_V       // Turn off verose debug messages   VLog();
#undef  LOG_UI      // Turn off popup messages          UILog();


// -- You should not have to mess with anything below this line --


// Be safe, start with all things defined
#define DEBUGLOG(...) do {} while (0)
#define ALERTLOG(...) do {} while (0)
#define ALWAYSLOG(...) do {} while (0)

// Define three basic debug types, DEBUGLOG, ALERTLOG and ALWAYSLOG
// These macros generally should not be called directly
// DEBUGLOG - show a message only when compiled for debugging
// ALERTLOG - show a popup window message only when compile for debugging
// ALWAYSLOG - show a message debugging and release
#ifdef __APPLE__
#ifdef DEBUG
#undef DEBUGLOG
#define DEBUGLOG(type, fmt, ...) NSLog((@"%@: %s [Line %d] " fmt), type, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#undef ALERTLOG
#if TARGET_OS_MAC
#define ALERTLOG(fmt, ...) DEBUGLOG(@"I", fmt, ##__VA_ARGS__)
#else
#define ALERTLOG(fmt, ...)  { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__]  delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#endif
#endif
#undef ALWAYSLOG
#define ALWAYSLOG(type, fmt, ...) NSLog((@"%@: %s [Line %d] " fmt), type, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif


// Create some standard logging macros
#ifdef LOG_D
#define DLog(fmt, ...) DEBUGLOG(@"D", fmt, ##__VA_ARGS__)
#else
#define DLog(...) do {} while (0)
#endif
#ifdef LOG_N
#define NLog(fmt, ...) DEBUGLOG(@"Net", fmt, ##__VA_ARGS__)
#else
#define NLog(...) do {} while (0)
#endif
#ifdef LOG_DB
#define DBLog(fmt, ...) DEBUGLOG(@"DB", fmt, ##__VA_ARGS__)
#else
#define DBLog(...) do {} while (0)
#endif
#ifdef LOG_V
#define VLog(fmt, ...) DEBUGLOG(@"V", fmt, ##__VA_ARGS__)
#else
#define VLog(...) do {} while (0)
#endif
#ifdef LOG_UI
#define UILog(fmt, ...) ALERTLOG(fmt, ##__VA_ARGS__)
#else
#define UILog(...) do {} while (0)
#endif
#define ALog(fmt, ...) ALWAYSLOG(@"V", fmt, ##__VA_ARGS__)
At very least, DO NOT copy-paste your macros directly into .pch file


  A PCH file is, by definition, a project specific precompiled header.
  It really shouldn't be used beyond the context of the project and it
  really shouldn't contain anything but #includes/#imports.


As suggested by an Apple engineer, you should make a separate file with your macros e.g. Defines.h, and just put #import Defines.h into .pch file.
I would suggest re-thinking you logging strategy. If it is not absolutely necessary (e.g. you do not have access to production instance of your app), you should log only the critical errors. Abundance of logging code decreases its readability/maintainability and can even CAUSE bugs. I recommend an excellent blog post on this matter from co-founder of Stack Overflow.