|
Lines 36-41
Link Here
|
| 36 |
|
36 |
|
| 37 |
#include "includes.h" |
37 |
#include "includes.h" |
| 38 |
|
38 |
|
|
|
39 |
#include <sys/time.h> |
| 39 |
#include <sys/types.h> |
40 |
#include <sys/types.h> |
| 40 |
|
41 |
|
| 41 |
#include <fcntl.h> |
42 |
#include <fcntl.h> |
|
Lines 443-449
do_log(LogLevel level, const char *fmt, va_list args)
Link Here
|
| 443 |
tmp_handler(level, fmtbuf, log_handler_ctx); |
444 |
tmp_handler(level, fmtbuf, log_handler_ctx); |
| 444 |
log_handler = tmp_handler; |
445 |
log_handler = tmp_handler; |
| 445 |
} else if (log_on_stderr) { |
446 |
} else if (log_on_stderr) { |
| 446 |
snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf); |
447 |
struct timeval tv; |
|
|
448 |
struct tm *tm; |
| 449 |
char timebuf[20]; |
| 450 |
|
| 451 |
gettimeofday(&tv, NULL); |
| 452 |
tm = localtime(&(tv.tv_sec)); |
| 453 |
(void)strftime(timebuf, sizeof timebuf, "%Y%m%dT%H%M%S", tm); |
| 454 |
snprintf(msgbuf, sizeof msgbuf, "%s.%03d %s\r\n", timebuf, |
| 455 |
(int)(tv.tv_usec/1000), fmtbuf); |
| 447 |
(void)write(log_stderr_fd, msgbuf, strlen(msgbuf)); |
456 |
(void)write(log_stderr_fd, msgbuf, strlen(msgbuf)); |
| 448 |
} else { |
457 |
} else { |
| 449 |
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) |
458 |
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) |