tags:

views:

68

answers:

2

Hi, using iphone sdk 4.0 I want to remove the function name stuff from this macro but am struggling

#define LOG(fmt, ...) NSLog((@"%s " fmt), __PRETTY_FUNCTION__,##__VA_ARGS__)

i tried

#define LOG(fmt, ...) NSLog((@"%s " fmt), ##__VA_ARGS__)

but this results in a crash!!

I want to be able to log like this

LOG("text to log");
LOG("text to log with param %d", param); etc
+1  A: 

I think you want this

#define Log(fmt, ...) NSLog(fmt, ##__VA_ARGS__);
Ian1971
already tried that,it doesn't work as i already have all my log statementsLOG("some text"); ie without the @
tech74
find LOG(" replace LOG(@"
Ian1971
A: 

Why not simply like this ?

#define LOG(fmt, ...) NSLog(@fmt, ##__VA_ARGS__)
rems4
thanks that did it
tech74