1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
/*
* Copyright (c) 2005 Christophe Varoqui
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "log_pthread.h"
#include <sys/types.h>
#include <time.h>
#include "../third-party/valgrind/drd.h"
#include "vector.h"
#include "config.h"
#include "defaults.h"
#include "debug.h"
#include "time-util.h"
#include "util.h"
int logsink;
int libmp_verbosity = DEFAULT_VERBOSITY;
void dlog(int prio, const char * fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if (logsink != LOGSINK_SYSLOG) {
if (logsink == LOGSINK_STDERR_WITH_TIME) {
struct timespec ts;
char buff[32];
get_monotonic_time(&ts);
safe_sprintf(buff, "%ld.%06ld",
(long)ts.tv_sec,
ts.tv_nsec/1000);
fprintf(stderr, "%s | ", buff);
}
vfprintf(stderr, fmt, ap);
}
else
log_safe(prio + 3, fmt, ap);
va_end(ap);
}
|