#include <alloca.h>
static char log_progname[32], *log_name_patt, *log_name;
-static pid_t log_pid;
+char *log_title;
+static int log_pid;
static int log_params;
static int log_name_size;
static int log_switching;
log_switching--;
}
-static void
-vlog(unsigned int cat, const char *msg, va_list args)
+void
+vlog_msg(unsigned int cat, const char *msg, va_list args)
{
time_t tim = time(NULL);
struct tm *tm = localtime(&tim);
p = buf = alloca(buflen);
*p++ = cat;
p += strftime(p, buflen, " %Y-%m-%d %H:%M:%S ", tm);
- if (log_progname[0])
+ if (log_title)
{
if (log_pid)
- p += sprintf(p, "[%s (%d)] ", log_progname, log_pid);
+ p += sprintf(p, "[%s (%d)] ", log_title, log_pid);
else
- p += sprintf(p, "[%s] ", log_progname);
+ p += sprintf(p, "[%s] ", log_title);
}
else
{
va_list args;
va_start(args, msg);
- vlog(cat, msg, args);
+ vlog_msg(cat, msg, args);
va_end(args);
}
va_list args;
va_start(args, msg);
- vlog(L_FATAL, msg, args);
+ vlog_msg(L_FATAL, msg, args);
va_end(args);
+#ifdef DEBUG_DIE_BY_ABORT
+ abort();
+#else
exit(1);
+#endif
}
#ifdef DEBUG
{
strncpy(log_progname, log_basename(argv0), sizeof(log_progname)-1);
log_progname[sizeof(log_progname)-1] = 0;
+ log_title = log_progname;
}
}