Skip to content

Commit

Permalink
Clear unnecessary logger calls
Browse files Browse the repository at this point in the history
  • Loading branch information
igorrius committed Oct 8, 2019
1 parent 30a3c36 commit 8de5846
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,19 @@ func (fsm *Fsm) ProcessEvent(event Event, eventCtx EventContext) error {
// get action function for this state
f, ok := fsm.actionMap[fsm.state]
if !ok || f == nil {
fsm.logger.Logf("Event [%s] for State [%s] processing failed", event, fsm.state)
fsm.logger.Logf("For event [%s] state [%s] action function is not defined", event, fsm.state)
return ErrActionNotFound
}

// check fsm and event contexts for error before the action call
if err := checkErrors(fsm.ctx.Err(), eventCtx.Err()); err != nil {
fsm.logger.Log("Before the action call contexts error: ", err.Error())
return err
}

// create new context with current state value
fsmCtx := ctxWithState(fsm.ctx, fsm.state)
nextState, nextCtx, err := f(eventCtx, fsmCtx)
if err != nil {
fsm.logger.Logf("State [%s] action func error: %s", fsm.state, err.Error())
return err
}

Expand All @@ -111,7 +109,6 @@ func (fsm *Fsm) ProcessEvent(event Event, eventCtx EventContext) error {

// check fsm, nextFsm and event contexts for error after the action call
if err := checkErrors(eventCtx.Err(), fsmCtx.Err(), nextCtx.Err()); err != nil {
fsm.logger.Log("After the action call contexts error: ", err.Error())
return err
}

Expand Down

0 comments on commit 8de5846

Please sign in to comment.