Objective-C Tips & Trick - Prioregroup.com
[Objective-C] Loggin (NSLog) only in Debug mode
       
back

// first define -DDEBUG=1 in Target --> Build Settings --> Other C Flags
// after define the macro below in .PCH file of your project
// and use it in the same way of NSLog.

#ifdef DEBUG
    #define LLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
    #define LLog( s, ... )
#endif






Copyright © 1996-2018 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.
prioregroup.com