Do not print debug messages by default.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
95185673f5
commit
851675833a
12
print.c
12
print.c
|
@ -21,19 +21,27 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue