ios - Category for simplified NSLogging of BOOLs -


i trying create code, this.

nslogbool(self.propertyname) 

and output in debugger console be

"propertyname set yes." 

any hints @ how could achieve that, , code not depend on particular class, i.e. have function usable class?

if need decoupled particular class, using preprocessor , c best bet. should work fine.

#define nsboollog(x) cfilogboolean(#x, x)  extern void cfilogboolean(char *propertyname, bool val);  void cfilogboolean(char *propname, bool val) {     printf("%s set %s", propname, (val ? "yes" : "no")); } 

as long extern declaration put header (possibly utility header, or common set of typedefs, etc.) that's visible compilation units, can used freely without having rely on class.


Comments