diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-25 03:09:09 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-25 03:09:09 +0100 |
commit | 2e3db52da98716e6ec204aee74290b6303d47280 (patch) | |
tree | 45a3ce57320e6c3f6b9a1295cabb07495085a64f /src | |
parent | 4cdf07519a9582afa9d2deeb6d9f54597b8268a1 (diff) |
bus: also write debug logs about messages we send
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-bus/sd-bus.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 3a4821319e..9b93ff7e1b 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -1362,14 +1362,33 @@ int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) { 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(message); + assert(m); if (bus->is_kernel) - return bus_kernel_write_message(bus, message); + r = bus_kernel_write_message(bus, m); 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) { |