Using DP() instead of logmsg() for RH_DEBUG msg
authorNeutron Soutmun <neo.neutron@gmail.com>
Tue, 19 Aug 2008 17:30:46 +0000 (00:30 +0700)
committerNeutron Soutmun <neo.neutron@gmail.com>
Sun, 2 Nov 2008 19:43:11 +0000 (02:43 +0700)
2008-08-20  Neutron Soutmun <neo.neutron@gmail.com>

* src/rahunas.{h,c}:
  - Replace logmsg which using RH_DEBUG to new DP().

ChangeLog
src/rahunasd.c
src/rahunasd.h

index d49b899..65299ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-08-20  Neutron Soutmun <neo.neutron@gmail.com>
 
+       * src/rahunas.{h,c}:
+         - Replace logmsg which using RH_DEBUG to new DP().
+
+2008-08-20  Neutron Soutmun <neo.neutron@gmail.com>
+
        * src/rahunas.h:
          - Add predefine RH_LOG_LEVEL and set it to RH_LOG_NORMAL.
          - Remove unneccessary code.
index 787f98a..6aae97d 100644 (file)
@@ -49,17 +49,17 @@ uint32_t iptoid(struct rahunas_map *map, const char *ip) {
          return (-1);
 
   if (!(inet_aton(ip, &req_ip))) {
-    logmsg(RH_LOG_DEBUG, "Could not convert IP: %s", ip);
+    DP("Could not convert IP: %s", ip);
     return (-1);  
   }
 
-  //logmsg(RH_LOG_DEBUG, "Request IP: %s", ip);
+  DP("Request IP: %s", ip);
        
   ret = ntohl(req_ip.s_addr) - ntohl(map->first_ip);
        if (ret < 0 || ret > (map->size - 1))
          ret = (-1);
 
-  //logmsg(RH_LOG_DEBUG, "Request Index: %lu", ret);
+  DP("Request Index: %lu", ret);
   return ret; 
 }
 
@@ -288,7 +288,7 @@ int parse_set_list(const char *in, struct rahunas_map *map)
        members = map->members;
 
   // Found members
-  //logmsg(RH_LOG_DEBUG, in);
+  DP("Parse from list: %s", in);
        sep = strstr(in, ":");
        sess_ip = strndup(in, sep - in);
   if (sess_ip == NULL)
@@ -381,14 +381,14 @@ int update_set(struct rahunas_map *map)
 
                  if (members[i].expired) {
          if (!no_detail) {
-                   logmsg(RH_LOG_DEBUG, "IP %s, Client: Username %s, "
-                                        "Session-ID %s, Session-Start %d, "
-                                 "Expired %d",
-                                 idtoip(map, i),
-                                                                                                members[i].username, 
-                                                                                                members[i].session_id,
-                                                                                                members[i].session_start,
-                                 members[i].expired);
+                   DP("IP %s, Client: Username %s, "
+                      "Session-ID %s, Session-Start %d, "
+               "Expired %d",
+               idtoip(map, i),
+                            members[i].username, 
+                            members[i].session_id,
+                            members[i].session_start,
+               members[i].expired);
 
                              send_xmlrpc_stopacct(map, i);
           }
@@ -449,11 +449,11 @@ int send_xmlrpc_stopacct(struct rahunas_map *map, uint32_t id) {
   
   if (gnet_xmlrpc_client_call(client, "stopacct", params, &reply) == 0)
     {
-      logmsg(RH_LOG_DEBUG, "stopacct reply = %s", reply);
+      DP("stopacct reply = %s", reply);
       g_free(reply);
     }
   else
-    logmsg(RH_LOG_DEBUG, "Failed executing stopacct!");
+    DP("%s", "Failed executing stopacct!");
        
        g_free(params);
 
@@ -494,7 +494,7 @@ int rh_init_members (struct rahunas_map* map)
 
 gboolean polling(gpointer data) {
   struct rahunas_map *map = (struct rahunas_map *)data;
-       logmsg(RH_LOG_DEBUG, "Start polling!");
+       DP("%s", "Start polling!");
        chk_set (map);
        update_set (map);
   return TRUE;
index 6efa520..50dd2ba 100644 (file)
@@ -73,7 +73,7 @@ enum RH_LOG {
     fprintf(stderr, format "\n", ## args); \
   } while (0)
 #else
-#define DP(priority, format, args...)
+#define DP(format, args...)
 #endif
 
 #endif // __RAHUNASD_H