Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simpler NSLog macro

Tags:

iphone

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
like image 978
tech74 Avatar asked Feb 26 '23 16:02

tech74


1 Answers

Why not simply like this ?

#define LOG(fmt, ...) NSLog(fmt, ##__VA_ARGS__)
like image 57
rems4 Avatar answered Mar 08 '23 17:03

rems4