Closed laphone32 closed 8 years ago
Hi,
But doing that doesn't make much sense, since it will render many zf_log features useless. For example, in debug, each line will contain source location info@your_logging.c:56
, since ZF_LOG*()
always will be called from this function. And no zero-cost no-op logging in release either, because this info()
function will not be no-op. Also per-module log level and tag control macros will be broken, because from this perspective there will be only one module - your_logging.c
. I would recommend doing something like that instead:
#define info(...) ZF_VLOGI(__VA_ARGS__)
So, wrapping ZF_LOG*()
invocations into a function is not very useful. If I missing something, please describe what you are trying to accomplish in more details.
Hi,
I could understand that wil lost the power of macro, and so the profit from preprocessor. Thus the only way to wrap the log functions would be macro wrapping.
Thanks!
Hi,
It would be great if there is va_list version of logging functions/macros be released for customized package, something like:
ZF_VLOGI(valist)
would be help when we have our own logging function:
void info(/*blah blah*/ const char *fmt, ...) { va_list vl; va_start(vl, fmt); /* blah blah */ ZF_VLOGI(fmt, vl); va_close(); }
Of course ZF_LOGI_STR() with an extra snprint() could do the same, but one more snprintf costs. Thanks!