wl_log(const char *fmt, ...)
{
va_list argp;
+ static int has_dlog = 0;
wl_abort_errno = errno;
#ifdef HAVE_DLOG
- dlog_print(DLOG_ERROR, WLLOG_TAG, "[wl_abort] abort_errno=%d (%s)", wl_abort_errno, strerror(wl_abort_errno));
+ has_dlog = 1;
va_start(argp, fmt);
dlog_vprint(DLOG_ERROR, WLLOG_TAG, fmt, argp);
va_end(argp);
#endif
- va_start(argp, fmt);
- wl_log_handler(fmt, argp);
- va_end(argp);
+ /* Disable printing log to stderr when it is being printed via dlog.
+ * If wl_log_handler has been overriden, it must be called to handle logs properly. */
+ if (!has_dlog || (wl_log_handler != wl_log_stderr_handler)) {
+ va_start(argp, fmt);
+ wl_log_handler(fmt, argp);
+ va_end(argp);
+ }
}
void