]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: introduce ha_notice()
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 21 Nov 2018 17:04:52 +0000 (18:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Nov 2018 18:02:23 +0000 (19:02 +0100)
It's like ha_warning() or ha_alert() but with a NOTICE prefix.

include/proto/log.h
src/log.c

index 577e570ee2fefd6e972d3aa2c1d4af87ba4bec85..e12743165630c155db4152f5906e4f7d0519925a 100644 (file)
@@ -110,6 +110,12 @@ void ha_alert(const char *fmt, ...)
 void ha_warning(const char *fmt, ...)
        __attribute__ ((format(printf, 1, 2)));
 
+/*
+ * Displays the message on stderr with the date and pid.
+ */
+void ha_notice(const char *fmt, ...)
+       __attribute__ ((format(printf, 1, 2)));
+
 /*
  * Displays the message on <out> only if quiet mode is not set.
  */
index 87019b08abf57b0dcb849e950dd4fe17526a9400..3db3c0d9e4a2073dd71348be7ace0a1f14ee198a 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -921,6 +921,20 @@ void ha_warning(const char *fmt, ...)
        }
 }
 
+/*
+ * Displays the message on stderr with the date and pid.
+ */
+void ha_notice(const char *fmt, ...)
+{
+       va_list argp;
+
+       if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) {
+               va_start(argp, fmt);
+               print_message("NOTICE", fmt, argp);
+               va_end(argp);
+       }
+}
+
 /*
  * Displays the message on <out> only if quiet mode is not set.
  */