From 851675833af3e6948a66ea7014b92b999374b44b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Fri, 30 Dec 2011 10:23:03 +0100 Subject: [PATCH] Do not print debug messages by default. Signed-off-by: Richard Cochran --- print.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/print.c b/print.c index e5cb4f2..c4b1e6a 100644 --- a/print.c +++ b/print.c @@ -21,19 +21,27 @@ #include #include +#include "print.h" + static int verbose = 1; +static int print_level = LOG_INFO; void print(int level, char const *format, ...) { - pid_t pid = getpid(); + pid_t pid; va_list ap; char buf[1024]; + if (level > print_level) + return; + + pid = getpid(); + va_start(ap, format); vsnprintf(buf, sizeof(buf), format, ap); va_end(ap); if (verbose) { - fprintf(stdout, "linuxptp[%d]: %s\n", pid, buf); + fprintf(stdout, "ptp4l[%d]: %s\n", pid, buf); } }