dhcp-client: Log DHCP messages at higher priority.
authorBen Pfaff <blp@nicira.com>
Tue, 14 Oct 2008 23:08:36 +0000 (16:08 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 14 Oct 2008 23:14:13 +0000 (16:14 -0700)
Logging DHCP messages sent or received with priority DBG made it hard
to see what was happening.  So log them at priority WARN, but also make
them less verbose at that level since seeing the whole message is not
too useful most of the time.

lib/dhcp-client.c

index 5e54017df182d4b9c1c79ae9a5e66e4eb72d84bb..c770f2a60385087f6acf045062b6ee5f8d6d374b 100644 (file)
@@ -943,8 +943,12 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg)
         ofpbuf_pull(&b, (char *)b.l7 - (char*)b.data);
         error = dhcp_parse(msg, &b);
         if (!error) {
-            VLOG_DBG_RL(&rl, "received %s",
-                        dhcp_msg_to_string(msg, false, &cli->s));
+            if (VLOG_IS_DBG_ENABLED()) {
+                VLOG_DBG_RL(&rl, "received %s",
+                            dhcp_msg_to_string(msg, false, &cli->s)); 
+            } else {
+                VLOG_WARN_RL(&rl, "received %s", dhcp_type_name(msg->type));
+            }
             ofpbuf_uninit(&b);
             return true;
         }
@@ -1019,7 +1023,11 @@ do_send_msg(struct dhclient *cli, const struct dhcp_msg *msg)
      * frame to have to be discarded or fragmented if it travels over a regular
      * Ethernet at some point.  1500 bytes should be enough for anyone. */
     if (b.size <= ETH_TOTAL_MAX) {
-        VLOG_DBG("sending %s", dhcp_msg_to_string(msg, false, &cli->s));
+        if (VLOG_IS_DBG_ENABLED()) {
+            VLOG_DBG("sending %s", dhcp_msg_to_string(msg, false, &cli->s)); 
+        } else {
+            VLOG_WARN("sending %s", dhcp_type_name(msg->type));
+        }
         error = netdev_send(cli->netdev, &b);
         if (error) {
             VLOG_ERR("send failed on %s: %s",