mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
use ctime1
Originally committed as revision 13864 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
124ed1c073
commit
9fd3442f63
40
ffserver.c
40
ffserver.c
@ -304,27 +304,6 @@ static AVRandomState random_state;
|
||||
|
||||
static FILE *logfile = NULL;
|
||||
|
||||
static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
|
||||
{
|
||||
static int print_prefix = 1;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
||||
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);
|
||||
fflush(logfile);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static char *ctime1(char *buf2)
|
||||
{
|
||||
time_t ti;
|
||||
@ -339,6 +318,25 @@ static char *ctime1(char *buf2)
|
||||
return buf2;
|
||||
}
|
||||
|
||||
static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
|
||||
{
|
||||
static int print_prefix = 1;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
||||
if (logfile) {
|
||||
if (print_prefix) {
|
||||
char buf[32];
|
||||
ctime1(buf);
|
||||
fprintf(logfile, "%s ", buf);
|
||||
}
|
||||
print_prefix = strstr(fmt, "\n") != NULL;
|
||||
vfprintf(logfile, fmt, ap);
|
||||
fflush(logfile);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void log_connection(HTTPContext *c)
|
||||
{
|
||||
char buf2[32];
|
||||
|
Loading…
Reference in New Issue
Block a user