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 --- src/fsm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/fsm.c b/src/fsm.c index 9dc6b987..1db39f75 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -311,11 +311,9 @@ int osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, /* validate if new_state is a valid state */ if (!(st->out_state_mask & (1 << new_state))) { - LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): transition to " - "state %s not permitted!\n", - osmo_fsm_inst_name(fi), - osmo_fsm_state_name(fsm, fi->state), - osmo_fsm_state_name(fsm, new_state)); + LOGPFSML(fi, LOGL_ERROR, + "transition to state %s not permitted!\n", + osmo_fsm_state_name(fsm, new_state)); return -EPERM; } @@ -376,10 +374,9 @@ int osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data) } if (!((1 << event) & fs->in_event_mask)) { - LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): Event %s not " - "permitted\n", osmo_fsm_inst_name(fi), - osmo_fsm_state_name(fsm, fi->state), - osmo_fsm_event_name(fsm, event)); + LOGPFSML(fi, LOGL_ERROR, + "Event %s not permitted\n", + osmo_fsm_event_name(fsm, event)); return -1; } fs->action(fi, event, data); -- cgit v1.2.3