From 5ae591757a89ec0ed26ae031fdd76e5dea841412 Mon Sep 17 00:00:00 2001 From: Timothy Redaelli Date: Tue, 5 Mar 2024 21:37:31 +0100 Subject: [PATCH] bfd: Improve state change log message. A log message like this one: 2024-01-09T06:45:17.201Z|00071|bfd(handler2)|INFO|ovn-0af536-0: BFD state change: down->up "Neighbor Signaled Session Down"->"Neighbor Signaled Session Down". can be hard to read since '->' usually represents a status change, but in this case the diagnostic code stays constant. Update the log message to avoid such ambiguity. The log message for the above event become: 2024-01-09T06:45:16.211Z|00026|bfd(handler3)|INFO|ovn-0af536-0: BFD state change: (bfd.SessionState: down, bfd.LocalDiag: "Neighbor Signaled Session Down") -> (bfd.SessionState: up, bfd.LocalDiag: "Neighbor Signaled Session Down") Reported-by: Alex Stupnikov Reported-at: https://bugzilla.redhat.com/2258496 Acked-by: Eelco Chaudron Signed-off-by: Timothy Redaelli Signed-off-by: Ilya Maximets --- lib/bfd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/bfd.c b/lib/bfd.c index 9af258917bb..b8149e78973 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -1130,10 +1130,11 @@ bfd_set_state(struct bfd *bfd, enum state state, enum diag diag) if (!VLOG_DROP_INFO(&rl)) { struct ds ds = DS_EMPTY_INITIALIZER; - ds_put_format(&ds, "%s: BFD state change: %s->%s" - " \"%s\"->\"%s\".\n", + ds_put_format(&ds, "%s: BFD state change: (bfd.SessionState: %s," + " bfd.LocalDiag: \"%s\") -> (bfd.SessionState: %s," + " bfd.LocalDiag: \"%s\")\n", bfd->name, bfd_state_str(bfd->state), - bfd_state_str(state), bfd_diag_str(bfd->diag), + bfd_diag_str(bfd->diag), bfd_state_str(state), bfd_diag_str(diag)); bfd_put_details(&ds, bfd); VLOG_INFO("%s", ds_cstr(&ds));