diff options
author | Thomas Haller <thaller@redhat.com> | 2016-03-11 14:09:50 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-03-17 15:00:48 +0100 |
commit | c68dd4a202bf88a2b7d72ab69875ec8300c34548 (patch) | |
tree | d268d29c0e129f539baa89b0bdf152a4459c630d /src/devices/nm-lldp-listener.c | |
parent | 9c5265621c149727a8e40db3a86104e528dfd9fe (diff) | |
download | NetworkManager-c68dd4a202bf88a2b7d72ab69875ec8300c34548.tar.gz |
lldp: improve logging
Diffstat (limited to 'src/devices/nm-lldp-listener.c')
-rw-r--r-- | src/devices/nm-lldp-listener.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index ef5fe6f643..16ad59bce9 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -102,6 +102,9 @@ static void process_lldp_neighbors (NMLldpListener *self); } \ } G_STMT_END \ +#define LOG_NEIGH_FMT "CHASSIS=%s%s%s PORT=%s%s%s" +#define LOG_NEIGH_ARG(neigh) NM_PRINT_FMT_QUOTE_STRING ((neigh)->chassis_id), NM_PRINT_FMT_QUOTE_STRING ((neigh)->port_id) + /*****************************************************************************/ static gboolean @@ -584,7 +587,12 @@ process_lldp_neighbors (NMLldpListener *self) neigh = lldp_neighbor_new (neighbors[i], p_parse_error); if (!neigh || !neigh->valid) { if (p_parse_error) { - _LOGT ("process: %s", parse_error->message); + if (neigh) + _LOGT ("process: failed to parse neighbor: %s", parse_error->message); + else { + _LOGT ("process: failed to parse neighbor "LOG_NEIGH_FMT": %s", + LOG_NEIGH_ARG (neigh), parse_error->message); + } g_clear_error (&parse_error); } continue; @@ -610,9 +618,9 @@ process_lldp_neighbors (NMLldpListener *self) break; } - _LOGD ("process: %s neigh: CHASSIS='%s' PORT='%s'", + _LOGD ("process: %s neigh: "LOG_NEIGH_FMT, neigh_old ? "update" : "new", - neigh->chassis_id, neigh->port_id); + LOG_NEIGH_ARG (neigh)); changed = TRUE; g_hash_table_add (priv->lldp_neighbors, nm_unauto (&neigh)); @@ -624,9 +632,9 @@ process_lldp_neighbors (NMLldpListener *self) if (prune_list) { g_hash_table_iter_init (&iter, prune_list); while (g_hash_table_iter_next (&iter, (gpointer *) &neigh_old, NULL)) { - _LOGD ("process: %s neigh: CHASSIS='%s' PORT='%s'", + _LOGD ("process: %s neigh: "LOG_NEIGH_FMT, "remove", - neigh_old->chassis_id, neigh_old->port_id); + LOG_NEIGH_ARG (neigh_old)); if (!g_hash_table_remove (priv->lldp_neighbors, neigh_old)) g_warn_if_reached (); changed = TRUE; |