I made a custom logging class that logs certain things to a file. I'm trying to make a macro so that I can use my custom class just like NSLog()
, but it doesn't seem to be working right.
Here's how I'm defining the macro:
#define ECLog(fmt, ...) [ECLogger logText:fmt, ## __VA_ARGS__]
logText:
is declared like this:
+ (void)logText:(NSString *)theString;
If I only pass one argument, it works fine. Like this:
ECLog(@"test");
But if I pass another argument, like this:
ECLog(@"test %@",someString);
I get an error that it was only expecting one argument.
Any ideas?