From 88bfa3801e187ac33ca9de552612bc30a1708c72 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 6 Sep 2024 15:17:07 +1000 Subject: flow: Helpers to log details of a flow The details of a flow - endpoints, interfaces etc. - can be pretty important for debugging. We log this on flow state transitions, but it can also be useful to log this when we report specific conditions. Add some helper functions and macros to make it easy to do that. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- flow.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'flow.h') diff --git a/flow.h b/flow.h index d167b65..24ba3ef 100644 --- a/flow.h +++ b/flow.h @@ -264,4 +264,11 @@ void flow_log_(const struct flow_common *f, int pri, const char *fmt, ...) flow_dbg((f), __VA_ARGS__); \ } while (0) +void flow_log_details_(const struct flow_common *f, int pri, + enum flow_state state); +#define flow_log_details(f_, pri) \ + flow_log_details_(&((f_)->f), (pri), (f_)->f.state) +#define flow_dbg_details(f_) flow_log_details((f_), LOG_DEBUG) +#define flow_err_details(f_) flow_log_details((f_), LOG_ERR) + #endif /* FLOW_H */ -- cgit v1.2.3