chiark / gitweb /
networkd: improve logging
authorTom Gundersen <teg@jklm.no>
Thu, 16 Jan 2014 13:59:26 +0000 (14:59 +0100)
committerTom Gundersen <teg@jklm.no>
Thu, 16 Jan 2014 19:32:08 +0000 (20:32 +0100)
src/network/networkd-link.c
src/network/networkd.c

index 993931d..8960b60 100644 (file)
@@ -580,6 +580,7 @@ static int link_update_flags(Link *link, unsigned flags) {
                         if (link->network->dhcp) {
                                 r = link_acquire_conf(link);
                                 if (r < 0) {
+                                        log_warning_link(link, "Could not acquire DHCPv4 lease: %s", strerror(-r));
                                         link_enter_failed(link);
                                         return r;
                                 }
@@ -590,6 +591,7 @@ static int link_update_flags(Link *link, unsigned flags) {
                         if (link->network->dhcp) {
                                 r = sd_dhcp_client_stop(link->dhcp);
                                 if (r < 0) {
+                                        log_warning_link(link, "Could not stop DHCPv4 client: %s", strerror(-r));
                                         link_enter_failed(link);
                                         return r;
                                 }
index 055200c..0e38920 100644 (file)
@@ -41,39 +41,52 @@ int main(int argc, char *argv[]) {
         }
 
         r = manager_new(&m);
-        if (r < 0)
+        if (r < 0) {
+                log_error("Could not create manager: %s", strerror(-r));
                 goto out;
+        }
 
         r = manager_load_config(m);
-        if (r < 0)
-                return EXIT_FAILURE;
+        if (r < 0) {
+                log_error("Could not load configuration files: %s", strerror(-r));
+                goto out;
+        }
 
         r = manager_udev_listen(m);
-        if (r < 0)
+        if (r < 0) {
+                log_error("Could not connect to udev: %s", strerror(-r));
                 goto out;
+        }
 
         r = manager_udev_enumerate_links(m);
-        if (r < 0)
+        if (r < 0) {
+                log_error("Could not enumerate links: %s", strerror(-r));
                 goto out;
+        }
 
         r = manager_rtnl_listen(m);
-        if (r < 0)
+        if (r < 0) {
+                log_error("Could not connect to rtnl: %s", strerror(-r));
                 goto out;
-
+        }
 
         /* write out empty resolv.conf to avoid a
          * dangling symlink */
         r = manager_update_resolv_conf(m);
-        if (r < 0)
+        if (r < 0) {
+                log_error("Could not create resolv.conf: %s", strerror(-r));
                 goto out;
+        }
 
         sd_notify(false,
                   "READY=1\n"
                   "STATUS=Processing requests...");
 
         r = sd_event_loop(m->event);
-        if (r < 0)
+        if (r < 0) {
+                log_error("Event loop failed: %s", strerror(-r));
                 goto out;
+        }
 
 out:
         sd_notify(false,