From 6a13e7f563e3983c51363704bd2a65e691bafc3e Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 14 Dec 2016 17:37:34 +0100 Subject: fsm: add LOGPFSML to pass explicit logging level Provide one central LOGPFSML to print FSM information, take the FSM logging subsystem from the FSM instance but use an explicitly provided log level instead of the FSM's default level. Use to replace some, essentially, duplications of the LOGPFSM macro. In effect, the fsm_test's expected error changes, since the previous code dup for logging events used round braces to indicate the fi's state, while the central macro uses curly braces. Change-Id: If295fdabb3f31a0fd9490d1e0df57794c75ae547 --- include/osmocom/core/fsm.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/osmocom') diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index fba5497b..026ed01a 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -110,11 +110,14 @@ struct osmo_fsm_inst { void osmo_fsm_log_addr(bool log_addr); -#define LOGPFSM(fi, fmt, args...) \ - LOGP((fi)->fsm->log_subsys, (fi)->log_level, "%s{%s}: " fmt, \ +#define LOGPFSML(fi, level, fmt, args...) \ + LOGP((fi)->fsm->log_subsys, level, "%s{%s}: " fmt, \ osmo_fsm_inst_name(fi), \ osmo_fsm_state_name((fi)->fsm, (fi)->state), ## args) +#define LOGPFSM(fi, fmt, args...) \ + LOGPFSML(fi, (fi)->log_level, 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