I have situation where:
#define DBG_ALOGD(a) ALOGD("%s:%d: ", __FUNCTION__, __LINE__); ALOGD a
#define DBG_MSG(a) do { if (debuggable) {DBG_ALOGD(a);} } while (0)
DBG_MSG(a)
used by the applications to print the logs.
DBG_MSG("Hi %d", 2);
will print as
LOG_TAG: function_name:121
LOG_TAG: Hi 2
I wanted combine FUNCTION:LINE along with the "Hi 2" in single line.
I tried
#define DBG_ALOGD(a) ALOGD("%s:%d:%s", __FUNCTION__, __LINE__, a)
#define DBG_MSG(a) do { if (debuggable) {DBG_ALOGD(a);} } while (0)
It didn't worked as a is not a plain string it also have %d
Please suggest how can I change the #define
to have a combination of these.