MT#62253 log: Introduce `ILOG_SDLG()`

Introduce `ILOG_SDLG()` call-id logging based on
specific getter provided to the macro func as a param.

This is required for those implementations,
where there is no within-file common dialog id getter.

Change-Id: I90501a0da32c7b8075e181796cf4c7c3f980e81e
mr13.4
Donat Zenichev 9 months ago
parent 700c1a0c51
commit 10ddc693a6

@ -194,6 +194,21 @@ _LOG(L_WARN, error_category " " fmt, ##args)
} \
} while (0)
#define ILOG_SDLG(level__, _get_callid, fmt, args...) \
do { \
int level_ = FIX_LOG_LEVEL(level__); \
if ((level_) <= log_level) { \
char formatted_msg[LOG_BUFFER_LEN]; \
int n_ = snprintf(formatted_msg, sizeof(formatted_msg), fmt, ##args); \
if (n_ > 0 && formatted_msg[n_ - 1] == '\n') \
formatted_msg[n_ - 1] = '\0'; \
if (strlen(_get_callid()) > 0) \
CALL_LOG_FUNC(level__, "%s - '%s'", formatted_msg, _get_callid()); \
else \
CALL_LOG_FUNC(level__, "%s - 'undefined call-id'", formatted_msg); \
} \
} while (0)
/** @} */
extern int log_level;

Loading…
Cancel
Save