xuzhenbao commented on issue #503:
URL: https://github.com/apache/celix/issues/503#issuecomment-1539266517
Now,we have celix_err, but how do we feed its error messages to the
logHelper?
How about do it in function `celix_logHelper_vlogDetails`, as follows:
~~~
void celix_logHelper_vlogDetails(celix_log_helper_t* logHelper,
celix_log_level_e level, const char* file, const char* function, int line,
const char *format, va_list formatArgs) {
if (level == CELIX_LOG_LEVEL_DISABLED) {
//silently ignore
celix_err_resetErrors();
return;
}
if (level >= logHelper->activeLogLevel) {
celixThreadMutex_lock(&logHelper->mutex);
celix_log_service_t* ls = logHelper->logService;
if (ls != NULL) {
ls->vlog(ls->handle, level, format, formatArgs);
for (const char *errMsg = celix_err_popLastError(); errMsg !=
NULL; errMsg = celix_err_popLastError()) {
ls->log(ls->handle, level, "%s", errMsg);
}
} else {
//falling back on stdout/stderr
celix_logUtils_vLogToStdout(logHelper->logServiceName, level,
format, formatArgs);
for (const char *errMsg = celix_err_popLastError(); errMsg !=
NULL; errMsg = celix_err_popLastError()) {
celix_logUtils_logToStdout(logHelper->logServiceName, level,
"%s", errMsg);
}
}
logHelper->logCount += 1;
celixThreadMutex_unlock(&logHelper->mutex);
}
celix_err_resetErrors();
}
~~~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]