Do not print debug messages by default.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2011-12-30 10:23:03 +01:00
parent 95185673f5
commit 851675833a
1 changed files with 10 additions and 2 deletions

12
print.c
View File

@ -21,19 +21,27 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include "print.h"
static int verbose = 1; static int verbose = 1;
static int print_level = LOG_INFO;
void print(int level, char const *format, ...) void print(int level, char const *format, ...)
{ {
pid_t pid = getpid(); pid_t pid;
va_list ap; va_list ap;
char buf[1024]; char buf[1024];
if (level > print_level)
return;
pid = getpid();
va_start(ap, format); va_start(ap, format);
vsnprintf(buf, sizeof(buf), format, ap); vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap); va_end(ap);
if (verbose) { if (verbose) {
fprintf(stdout, "linuxptp[%d]: %s\n", pid, buf); fprintf(stdout, "ptp4l[%d]: %s\n", pid, buf);
} }
} }