Log time with message.

pull/95/head
nicm 2015-08-28 12:15:54 +00:00
parent b6618b631b
commit 18d4802a7b
1 changed files with 3 additions and 1 deletions

4
log.c
View File

@ -67,11 +67,13 @@ void
log_vwrite(const char *msg, va_list ap)
{
char *fmt;
time_t t;
if (log_file == NULL)
return;
if (asprintf(&fmt, "%s\n", msg) == -1)
t = time(NULL);
if (asprintf(&fmt, "%lld %s\n", (long long)t, msg) == -1)
exit(1);
if (vfprintf(log_file, fmt, ap) == -1)
exit(1);