// macro magic :D:D #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) #ifdef DEBUG #define LOG(x, ...) logzor( "NIHLEDTEST " __FILE__ ":" \ TOSTRING(__LINE__) " : " __FUNCTION__ "() ==> " x "n", __VA_ARGS__) #else #define LOG(x, ...) #endif #ifdef DEBUG static __inline void logzor(char *msg, ...) { va_list argptr; va_start(argptr, msg); vfprintf(stderr, msg, argptr); va_end(argptr); } #endif
According to The Directive 2009/24/EC of the European Parliament and of the Council, and Sec.103(f) of the DMCA (17 U.S.C. § 1201 (f)), the reverse engineering act committed to creating these blog posts is considered legal, as this is an original attempt to improve interoperability, and cannot be waived by license agreements.
The views expressed on this blog are my own and do not necessarily reflect the views of my past and present employers.
2013-08-29
C: Log a message through a macro with the current function name and line number
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment