From eeacf906dd961002dba7e53ec9144d08a2b2d0ee Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 23 Dec 2016 01:00:13 +0100 Subject: fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h LOGPFSM and LOGPFSML are in the header file, put the *SRC variants also there so users of the osmo_fsm_inst API may conveniently create own functions that log the caller's source file and line. Very useful if many action functions call the same event dispatching function, like foo_fsm_done(), and one needs to know which of the callers to debug. Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80 --- include/osmocom/core/fsm.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/osmocom/core/fsm.h') diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 57d9a76c..8f65533b 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -125,6 +125,19 @@ void osmo_fsm_log_addr(bool log_addr); #define LOGPFSM(fi, fmt, args...) \ LOGPFSML(fi, (fi)->log_level, fmt, ## args) +#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \ + LOGPSRC((fi)->fsm->log_subsys, level, \ + caller_file, caller_line, \ + "%s{%s}: " fmt, \ + osmo_fsm_inst_name(fi), \ + osmo_fsm_state_name((fi)->fsm, (fi)->state), \ + ## args) + +#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \ + LOGPFSMLSRC(fi, (fi)->log_level, \ + caller_file, caller_line, \ + fmt, ## args) + int osmo_fsm_register(struct osmo_fsm *fsm); void osmo_fsm_unregister(struct osmo_fsm *fsm); struct osmo_fsm_inst *osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv, -- cgit v1.2.3