summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5cb5b41)
raw | patch | inline | side by side (parent: 5cb5b41)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 28 Oct 2007 08:57:17 +0000 (09:57 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Sun, 28 Oct 2007 10:47:10 +0000 (11:47 +0100) |
This saves a couple of useless calls to plugin_log() which the compiler
does not detect and remove itself.
A couple of DEBUG()'s in the apcups, hddtemp, mbmon and ntpd plugins have
been upgraded to INFO()'s. All of them provide error messages of failed
system / libc calls which should be available to the user somehow.
Besides, they use a local string buffer which generates an "unused
variable" warning if DEBUG() expands to a noop.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
does not detect and remove itself.
A couple of DEBUG()'s in the apcups, hddtemp, mbmon and ntpd plugins have
been upgraded to INFO()'s. All of them provide error messages of failed
system / libc calls which should be available to the user somehow.
Besides, they use a local string buffer which generates an "unused
variable" warning if DEBUG() expands to a noop.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/apcups.c | patch | blob | history | |
src/hddtemp.c | patch | blob | history | |
src/mbmon.c | patch | blob | history | |
src/ntpd.c | patch | blob | history | |
src/plugin.h | patch | blob | history |
diff --git a/src/apcups.c b/src/apcups.c
index 4f0bdfa69f8b64593e6b669a0c919c91cf89cdfb..174febe45f5a5346124d7ad97ec83890cc964bda 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
if (status != 0)
{
char errbuf[1024];
- DEBUG ("getaddrinfo failed: %s",
+ INFO ("getaddrinfo failed: %s",
(status == EAI_SYSTEM)
? sstrerror (errno, errbuf, sizeof (errbuf))
: gai_strerror (status));
if (status != 0) /* `connect(2)' failed */
{
char errbuf[1024];
- DEBUG ("connect failed: %s",
+ INFO ("connect failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
close (sd);
return (-1);
diff --git a/src/hddtemp.c b/src/hddtemp.c
index 0432de73adc825c9ac161bc3ea5dc5a5800f68a9..0a93920b99e4ce7e42c3d8a0b06c6fc91373c8e8 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
char errbuf[1024];
- DEBUG ("hddtemp: connect (%s, %s): %s", host, port,
+ INFO ("hddtemp: connect (%s, %s): %s", host, port,
sstrerror (errno, errbuf, sizeof (errbuf)));
close (fd);
fd = -1;
diff --git a/src/mbmon.c b/src/mbmon.c
index 384ecb5e6a5cda48d376ebea8b5aad3882a1143b..bad1a3884d86596b2f5600241ae83c5ee543b69c 100644 (file)
--- a/src/mbmon.c
+++ b/src/mbmon.c
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
char errbuf[1024];
- DEBUG ("mbmon: connect (%s, %s): %s", host, port,
+ INFO ("mbmon: connect (%s, %s): %s", host, port,
sstrerror (errno, errbuf,
sizeof (errbuf)));
close (fd);
diff --git a/src/ntpd.c b/src/ntpd.c
index 63b037a6440eb8006027dac12b8355cde0e24b5b..9e09f81982291dc3b60b3040e93eb4829838a342 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
if (status < 0)
{
char errbuf[1024];
- DEBUG ("recv(2) failed: %s",
+ INFO ("recv(2) failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
DEBUG ("Closing socket #%i", sd);
close (sd);
diff --git a/src/plugin.h b/src/plugin.h
index 4ca6c771f16c8d87f050c499b4f367cf85b6b970..7692ebdb0377eb3212a4c3a2da9931c837202d46 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
#define WARNING(...) plugin_log (LOG_WARNING, __VA_ARGS__)
#define NOTICE(...) plugin_log (LOG_NOTICE, __VA_ARGS__)
#define INFO(...) plugin_log (LOG_INFO, __VA_ARGS__)
-#define DEBUG(...) plugin_log (LOG_DEBUG, __VA_ARGS__)
+#if COLLECT_DEBUG
+# define DEBUG(...) plugin_log (LOG_DEBUG, __VA_ARGS__)
+#else /* COLLECT_DEBUG */
+# define DEBUG(...) /* noop */
+#endif /* ! COLLECT_DEBUG */
/* TODO: Move plugin_{complain,relief} into `utils_complain.[ch]'. -octo */
void plugin_complain (int level, complain_t *c, const char *format, ...);