   }
   
   public func setState(_ state: StateType) {
-    if debugMode { NSLog("FSM Set state \(state)") }
+    if debugMode { NSLog("FSM(\(name ?? "?")) SetState \(state)") }
+    
     let definition = definedState(state)!
     definition.state = state
     

    transitions.append(StateTransition(event: event, state: state, target: target))
  }
  
  public func transition(on event: EventType, from state: StateType, with target: @escaping () -> StateType?) {
    transitions.append(StateTransition(event: event, state: state, target: target))
  }

    }
  }
  
  public var name: String?
  public var debugMode: Bool = false // Shows some NSLog when set to true
  private var definitions: [StateDefinition] = []
  private var transitions: [StateTransition] = []
