- va_start(ap, fmt);
- if (vasprintf(&p, fmt, ap) == -1)
- abort();
- /* Strip trailing \n: diag adds it. */
- if (p[strlen(p)-1] == '\n')
- p[strlen(p)-1] = '\0';
- diag("tdb log level %u: %s%s", level, log_prefix, p);
- free(p);
- if (level != TDB_DEBUG_TRACE)
- tap_log_messages++;
- va_end(ap);
+ diag("tdb log level %u: %s: %s%s",
+ level, tdb_errorstr(ecode), log_prefix, message);
+ if (log_last)
+ free(log_last);
+ log_last = strdup(message);
+ tap_log_messages++;