logging: Add quiet option

Mostly for debug?
Sometimes logging changes timing.
This commit is contained in:
Kim Woelders
2023-02-10 09:26:34 +01:00
parent 6e5c44eb29
commit 895cfffc6b
3 changed files with 15 additions and 5 deletions
+8 -1
View File
@@ -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);