logging: Add quiet option
Mostly for debug? Sometimes logging changes timing.
This commit is contained in:
+8
-1
@@ -15,6 +15,8 @@
|
||||
|
||||
char log_level = 0;
|
||||
|
||||
static char log_threshold = LOG_DEBUG;
|
||||
|
||||
static FILE *log_dest = NULL;
|
||||
|
||||
void nvt_log_dest(int dest)
|
||||
@@ -34,8 +36,10 @@ void nvt_log_dest(int dest)
|
||||
}
|
||||
}
|
||||
|
||||
void nvt_log_level(int level)
|
||||
void nvt_log_level(int quiet, int level)
|
||||
{
|
||||
if (quiet)
|
||||
log_threshold = LOG_NOTICE;
|
||||
log_level = level;
|
||||
}
|
||||
|
||||
@@ -63,6 +67,9 @@ void nvt_log(int prio, const char *fmt, ...)
|
||||
const char *eol;
|
||||
int len;
|
||||
|
||||
if (prio > log_threshold)
|
||||
return;
|
||||
|
||||
va_start(arg, fmt);
|
||||
len = vsnprintf(buf, sizeof(buf), fmt, arg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user