python simple finite state machine and logger
Doing another exercise from LMPTHW, and I'm enjoying it. Only broke into Maximum recursion depth once so far. Also I found this good article on logger, and I am really going to start using it from now on. Just yeah. It's not much work at all to put it in there. ---logger article: https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/ So a picture of what my plan was going in: And a picture of the code results in Command Prompt ( Bash ): color codes link : http://www.lihaoyi.com /post/BuildyourownCommandLinewithANSIescapecodes.html#16-colors And I'm not sure I can explain well enough yet, but basically you're making a 'machine' that transitions to a predetermined amount of settings -- states. In my code, it's the class's functions [ FSM_OFF, FSM_GO, FSM_GREEN, FSM_YELLOW, FSM_RED, FSM_BLINKING_RED, FSM_ERROR] And the list of triggers/instructions to change the state are determined in each of those states. ...