- size_t remain = sizeof(buf) - strlen(buf);
- if (remain > 100) /* reasonable minimum space for error */
- {
- strcat(buf, " [");
- yaz_strerror(buf+strlen(buf), remain-5); /* 5 due to extra [] */
- strcat(buf, "]");
- }
+ char buf[1024];
+ /* 30 is enough for our 'rest of output' message */
+ yaz_vsnprintf(buf, sizeof(buf)-30, fmt, ap);
+ if (strlen(buf) >= sizeof(buf)-31)
+ strcat(buf, " [rest of output omitted]");
+ if (start_hook_func)
+ (*start_hook_func)(o_level, buf, start_hook_info);
+ if (hook_func)
+ (*hook_func)(o_level, buf, hook_info);
+ if (file)
+ yaz_log_to_file(level, fmt, ap, error_cp);
+ if (end_hook_func)
+ (*end_hook_func)(o_level, buf, end_hook_info);