mirror of https://git.ffmpeg.org/ffmpeg.git
print date in http_log
Originally committed as revision 13863 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
fa288df453
commit
124ed1c073
|
@ -306,10 +306,19 @@ static FILE *logfile = NULL;
|
||||||
|
|
||||||
static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
|
static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
static int print_prefix = 1;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
if (logfile) {
|
if (logfile) {
|
||||||
|
if (print_prefix) {
|
||||||
|
time_t current = time(0);
|
||||||
|
char buffer[32];
|
||||||
|
strncpy(buffer, ctime(¤t), 31);
|
||||||
|
buffer[strlen(buffer)-1] = 0; // remove '\n'
|
||||||
|
fprintf(logfile, "%s ", buffer);
|
||||||
|
}
|
||||||
|
print_prefix = strstr(fmt, "\n") != NULL;
|
||||||
vfprintf(logfile, fmt, ap);
|
vfprintf(logfile, fmt, ap);
|
||||||
fflush(logfile);
|
fflush(logfile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue