chiark / gitweb /
bus: also write debug logs about messages we send
authorLennart Poettering <lennart@poettering.net>
Wed, 25 Dec 2013 02:09:09 +0000 (03:09 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 25 Dec 2013 02:09:09 +0000 (03:09 +0100)
src/libsystemd-bus/sd-bus.c

index 3a48213..9b93ff7 100644 (file)
@@ -1362,14 +1362,33 @@ int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) {
         return bus_message_seal(m, 0xFFFFFFFFULL, 0);
 }
 
         return bus_message_seal(m, 0xFFFFFFFFULL, 0);
 }
 
-static int bus_write_message(sd_bus *bus, sd_bus_message *message, size_t *idx) {
+static int bus_write_message(sd_bus *bus, sd_bus_message *m, size_t *idx) {
+        int r;
+
         assert(bus);
         assert(bus);
-        assert(message);
+        assert(m);
 
         if (bus->is_kernel)
 
         if (bus->is_kernel)
-                return bus_kernel_write_message(bus, message);
+                r = bus_kernel_write_message(bus, m);
         else
         else
-                return bus_socket_write_message(bus, message, idx);
+                r = bus_socket_write_message(bus, m, idx);
+
+        if (r <= 0)
+                return r;
+
+        if (bus->is_kernel || bus->windex >= BUS_MESSAGE_SIZE(m))
+                log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s serial=%lu reply_serial=%lu error=%s",
+                          bus_message_type_to_string(m->header->type),
+                          strna(sd_bus_message_get_sender(m)),
+                          strna(sd_bus_message_get_destination(m)),
+                          strna(sd_bus_message_get_path(m)),
+                          strna(sd_bus_message_get_interface(m)),
+                          strna(sd_bus_message_get_member(m)),
+                          (unsigned long) m->header->serial,
+                          (unsigned long) m->reply_serial,
+                          strna(m->error.message));
+
+        return r;
 }
 
 static int dispatch_wqueue(sd_bus *bus) {
 }
 
 static int dispatch_wqueue(sd_bus *bus) {