From c0f313ed72229acdd10db4ce09e7456d7e3fb0a4 Mon Sep 17 00:00:00 2001 From: Jon Masters Date: Tue, 3 Mar 2009 18:22:09 -0500 Subject: [PATCH] logging: add quiet global and cleanup logging files Make a new global called "quiet" to replace the unknown silent that was being passed around. Strictly speaking, "quiet" is supposed to refer only to silently failing without warning on module load failure, but the docs have always (erroneously) said we would also be completely silent. The tests likewise have always assumed we will say nothing out stderr. So, I'm just going to start treating quiet as it has been actually used. This patch should have gone in a previous commit. Signed-off-by: Jon Masters --- logging.c | 10 ++++++++-- logging.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/logging.c b/logging.c index 22de287..92f7683 100644 --- a/logging.c +++ b/logging.c @@ -10,6 +10,12 @@ /* Do we use syslog for messages or stderr? */ int logging = 0; +/* Do we want to silently drop all warnings? */ +int quiet = 0; + +/* Number of times warn() has been called */ +int warned = 0; + void message(const char *prefix, const char *fmt, va_list *arglist) { int ret; @@ -34,13 +40,13 @@ void message(const char *prefix, const char *fmt, va_list *arglist) free(buf); } -int warned = 0; void warn(const char *fmt, ...) { va_list arglist; warned++; va_start(arglist, fmt); - message("WARNING: ", fmt, &arglist); + if (!quiet) + message("WARNING: ", fmt, &arglist); va_end(arglist); } diff --git a/logging.h b/logging.h index ad53d40..2c4a2f3 100644 --- a/logging.h +++ b/logging.h @@ -4,6 +4,9 @@ /* Do we use syslog for messages or stderr? */ extern int logging; +/* Do we want to silent drop all warnings? */ +extern int quiet; + /* Number of times warn() has been called */ extern int warned; -- 2.11.4.GIT