diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2013-09-01 15:06:15 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2013-09-03 13:03:55 -0500 |
commit | 2590bf7a2bc40e2fcd5cbe1f4f063d820c2c5438 (patch) | |
tree | d8b622d8795dc9367458fa3b9db038ac7d21927c /src/libeinfo | |
parent | 4ce3cb90a035b74f4f6bcce1a0f1bca841e6424f (diff) |
libeinfo: add separate variable to suppress eerror messages
Add an EERROR_QUIET environment variable which works like EINFO_QUIET
but for the eerror functions. This will allow library consumers to
choose whether to suppress eerror messages separately from einfo and
ewarn messages.
X-Gentoo-Bug: 482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
Diffstat (limited to 'src/libeinfo')
-rw-r--r-- | src/libeinfo/libeinfo.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c index 7b1f2da5..9791051f 100644 --- a/src/libeinfo/libeinfo.c +++ b/src/libeinfo/libeinfo.c @@ -274,6 +274,12 @@ is_quiet(void) } static bool +is_really_quiet(void) +{ + return yesno(getenv("EERROR_QUIET")); +} + +static bool is_verbose(void) { return yesno(getenv ("EINFO_VERBOSE")); @@ -674,7 +680,7 @@ eerrorn(const char *EINFO_RESTRICT fmt, ...) int retval; va_list ap; - if (!fmt || is_quiet()) + if (!fmt || is_really_quiet()) return 0; va_start(ap, fmt); retval = _eerrorvn(fmt, ap); @@ -742,7 +748,7 @@ eerror(const char *EINFO_RESTRICT fmt, ...) int retval; va_list ap; - if (!fmt || is_quiet()) + if (!fmt || is_really_quiet()) return 0; va_start(ap, fmt); elogv(LOG_ERR, fmt, ap); @@ -759,7 +765,7 @@ eerrorx(const char *EINFO_RESTRICT fmt, ...) { va_list ap; - if (fmt && !is_quiet()) { + if (fmt && !is_really_quiet()) { va_start(ap, fmt); elogv(LOG_ERR, fmt, ap); _eerrorvn(fmt, ap); |