Code

Replace all syslog-calls with one of the new logging-macros.
[collectd.git] / src / dns.c
index 56df1845ad512a3ea3c2e0f3f6061cd7760bb097..11dc287425fde2e2bc725fb67ccd8481ed536202 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -23,7 +23,6 @@
 #include "common.h"
 #include "plugin.h"
 #include "configfile.h"
-#include "utils_debug.h"
 
 #if HAVE_LIBPCAP && HAVE_LIBPTHREAD
 # include "utils_dns.h"
@@ -117,14 +116,14 @@ static counter_list_t *counter_list_search (counter_list_t **list, unsigned int
 {
        counter_list_t *entry;
 
-       DBG ("counter_list_search (list = %p, key = %u)",
+       DEBUG ("counter_list_search (list = %p, key = %u)",
                        (void *) *list, key);
 
        for (entry = *list; entry != NULL; entry = entry->next)
                if (entry->key == key)
                        break;
 
-       DBG ("return (%p)", (void *) entry);
+       DEBUG ("return (%p)", (void *) entry);
        return (entry);
 }
 
@@ -133,7 +132,7 @@ static counter_list_t *counter_list_create (counter_list_t **list,
 {
        counter_list_t *entry;
 
-       DBG ("counter_list_create (list = %p, key = %u, value = %u)",
+       DEBUG ("counter_list_create (list = %p, key = %u, value = %u)",
                        (void *) *list, key, value);
 
        entry = (counter_list_t *) malloc (sizeof (counter_list_t));
@@ -159,7 +158,7 @@ static counter_list_t *counter_list_create (counter_list_t **list,
                last->next = entry;
        }
 
-       DBG ("return (%p)", (void *) entry);
+       DEBUG ("return (%p)", (void *) entry);
        return (entry);
 }
 
@@ -168,7 +167,7 @@ static void counter_list_add (counter_list_t **list,
 {
        counter_list_t *entry;
 
-       DBG ("counter_list_add (list = %p, key = %u, increment = %u)",
+       DEBUG ("counter_list_add (list = %p, key = %u, increment = %u)",
                        (void *) *list, key, increment);
 
        entry = counter_list_search (list, key);
@@ -181,7 +180,7 @@ static void counter_list_add (counter_list_t **list,
        {
                counter_list_create (list, key, increment);
        }
-       DBG ("return ()");
+       DEBUG ("return ()");
 }
 
 static int dns_config (const char *key, const char *value)
@@ -253,7 +252,7 @@ static void *dns_child_loop (void *dummy)
        }
 
        /* Passing `pcap_device == NULL' is okay and the same as passign "any" */
-       DBG ("Creating PCAP object..");
+       DEBUG ("Creating PCAP object..");
        pcap_obj = pcap_open_live (pcap_device,
                        PCAP_SNAPLEN,
                        0 /* Not promiscuous */,
@@ -261,7 +260,7 @@ static void *dns_child_loop (void *dummy)
                        pcap_error);
        if (pcap_obj == NULL)
        {
-               syslog (LOG_ERR, "dns plugin: Opening interface `%s' "
+               ERROR ("dns plugin: Opening interface `%s' "
                                "failed: %s",
                                (pcap_device != NULL) ? pcap_device : "any",
                                pcap_error);
@@ -271,18 +270,18 @@ static void *dns_child_loop (void *dummy)
        memset (&fp, 0, sizeof (fp));
        if (pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0) < 0)
        {
-               DBG ("pcap_compile failed");
-               syslog (LOG_ERR, "dns plugin: pcap_compile failed");
+               DEBUG ("pcap_compile failed");
+               ERROR ("dns plugin: pcap_compile failed");
                return (NULL);
        }
        if (pcap_setfilter (pcap_obj, &fp) < 0)
        {
-               DBG ("pcap_setfilter failed");
-               syslog (LOG_ERR, "dns plugin: pcap_setfilter failed");
+               DEBUG ("pcap_setfilter failed");
+               ERROR ("dns plugin: pcap_setfilter failed");
                return (NULL);
        }
 
-       DBG ("PCAP object created.");
+       DEBUG ("PCAP object created.");
 
        dnstop_set_pcap_obj (pcap_obj);
        dnstop_set_callback (dns_child_callback);
@@ -292,10 +291,10 @@ static void *dns_child_loop (void *dummy)
                        handle_pcap /* callback */,
                        NULL /* Whatever this means.. */);
        if (status < 0)
-               syslog (LOG_ERR, "dns plugin: Listener thread is exiting "
+               ERROR ("dns plugin: Listener thread is exiting "
                                "abnormally: %s", pcap_geterr (pcap_obj));
 
-       DBG ("child is exiting");
+       DEBUG ("child is exiting");
 
        pcap_close (pcap_obj);
        listen_thread_init = 0;
@@ -321,7 +320,7 @@ static int dns_init (void)
                        (void *) 0);
        if (status != 0)
        {
-               syslog (LOG_ERR, "dns plugin: pthread_create failed: %s",
+               ERROR ("dns plugin: pthread_create failed: %s",
                                strerror (status));
                return (-1);
        }
@@ -393,7 +392,7 @@ static int dns_read (void)
 
        for (i = 0; i < len; i++)
        {
-               DBG ("qtype = %u; counter = %u;", keys[i], values[i]);
+               DEBUG ("qtype = %u; counter = %u;", keys[i], values[i]);
                submit_counter ("dns_qtype", qtype_str (keys[i]), values[i]);
        }
 
@@ -409,7 +408,7 @@ static int dns_read (void)
 
        for (i = 0; i < len; i++)
        {
-               DBG ("opcode = %u; counter = %u;", keys[i], values[i]);
+               DEBUG ("opcode = %u; counter = %u;", keys[i], values[i]);
                submit_counter ("dns_opcode", opcode_str (keys[i]), values[i]);
        }
 
@@ -425,7 +424,7 @@ static int dns_read (void)
 
        for (i = 0; i < len; i++)
        {
-               DBG ("rcode = %u; counter = %u;", keys[i], values[i]);
+               DEBUG ("rcode = %u; counter = %u;", keys[i], values[i]);
                submit_counter ("dns_rcode", rcode_str (keys[i]), values[i]);
        }