There is something that I fundamentally don't understand because I cannot for the life of me get this to work. I want to create a macro that extends NSLog(NSString *format, ...)
. Here is what I came up with:
NSLogExtensions.h
#define DebugLog(debugMode, format, ...) MyDebugLog(debugMode, [[NSString stringWithFormat:@"<%@> (Line %d): ", NSStringFromClass([self class]), __LINE__] stringByAppendingString:format], ##__VA_ARGS__)
@interface NSLogExtensions : NSObject
@end
NSLogExtensions.m
#import "NSLogExtensions.h"
@implementation NSLogExtensions
void MyDebugLog(bool debugMode, NSString *format, ...) {
va_list(argumentList);
va_start(argumentList, format);
if (debugMode) {
NSLogv(format, argumentList);
}
va_end(argumentList);
}
@end
I expected to be able to include the NSLogExtensions header file and then be able to use the macro, but I receive the GCC implicit function declaration warning still.