diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-10 11:38:12 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-10 11:38:12 +0200 |
commit | 9eb212568fb01021bd4592a0ae15ad05629bea47 (patch) | |
tree | 5df4c6d04990c60cc0d268cf8300108651473c48 /src/libsystemd/sd-bus/sd-bus.c | |
parent | 0117db19b69f89e8e0a91be01097fe6de30c7c07 (diff) | |
parent | f9f97ca6927af3a23d9c27e4edf65532ebf23e1e (diff) |
Merge pull request #117 from utezduyar/feat/dump-sync-dbus-message-with-logging-on
sd-bus: dump sync messages in debug mode
Diffstat (limited to 'src/libsystemd/sd-bus/sd-bus.c')
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index edc27aef87..147e6f0376 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -49,6 +49,20 @@ #include "bus-track.h" #include "bus-slot.h" +#define log_debug_bus_message(m) do { \ + sd_bus_message *_m = (m); \ + log_debug("1Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " 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)), \ + BUS_MESSAGE_COOKIE(_m), \ + _m->reply_cookie, \ + strna(_m->error.message)); \ + } while (false) + static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec); static int attach_io_events(sd_bus *b); static void detach_io_events(sd_bus *b); @@ -1992,6 +2006,7 @@ _public_ int sd_bus_call( memmove(bus->rqueue + i, bus->rqueue + i + 1, sizeof(sd_bus_message*) * (bus->rqueue_size - i - 1)); bus->rqueue_size--; + log_debug_bus_message(incoming); if (incoming->header->type == SD_BUS_MESSAGE_METHOD_RETURN) { @@ -2480,16 +2495,7 @@ static int process_message(sd_bus *bus, sd_bus_message *m) { bus->current_message = m; bus->iteration_counter++; - log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " 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)), - BUS_MESSAGE_COOKIE(m), - m->reply_cookie, - strna(m->error.message)); + log_debug_bus_message(m); r = process_hello(bus, m); if (r != 0) |