sum7
/
yaja
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
yaja/server/state/state.go

31 lines
609 B
Go

package state
import "dev.sum7.eu/genofire/yaja/server/utils"
// State processes the stream and moves to the next state
type State interface {
Process() State
}
// Start state
type Debug struct {
Next State
Client *utils.Client
}
// Process message
func (state *Debug) Process() State {
state.Client.Log = state.Client.Log.WithField("state", "debug")
state.Client.Log.Debug("running")
defer state.Client.Log.Debug("leave")
element, err := state.Client.Read()
if err != nil {
state.Client.Log.Warn("unable to read: ", err)
return nil
}
state.Client.Log.Info(element)
return state.Next
}