A discussion in #1683 prompted the question about adding slic macros that only log/warn the first time they're encountered.
I'd suggest adopted something like the following (based on code that @tomstitt wrote a few years ago):
#define SLIC_INFO_ONCE_IF(cond, msg) \
do \
{ \
static bool once = true; \
if (cond) \
{ \
if (once) \
{ \
SLIC_INFO(msg); \
once = false; \
} \
} \
} while (false)
#define SLIC_INFO_ONCE(msg) SLIC_INFO_ONCE_IF(true, msg)
#define SLIC_INFO_ONCE_ROOT_IF(cond, msg) \
do \
{ \
static bool once = true; \
if (cond) \
{ \
if (once) \
{ \
SLIC_INFO_ROOT(msg); \
once = false; \
} \
} \
} while (false)
#define SLIC_INFO_ONCE_ROOT(msg) SLIC_INFO_ONCE_ROOT_IF(true, msg)
We should also add similar macros for warnings and possibly debug.
A discussion in #1683 prompted the question about adding slic macros that only log/warn the first time they're encountered.
I'd suggest adopted something like the following (based on code that @tomstitt wrote a few years ago):
We should also add similar macros for warnings and possibly debug.