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 <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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue