lib/floe/workflow/state.rb in floe-0.9.0 vs lib/floe/workflow/state.rb in floe-0.10.0

- old
+ new

@@ -56,11 +56,11 @@ context.execution["StartTime"] ||= start_time context.state["Guid"] = SecureRandom.uuid context.state["EnteredTime"] = start_time - logger.info("Running state: [#{context.state_name}] with input [#{context.input}]...") + logger.info("Running state: [#{long_name}] with input [#{context.input}]...") end def finish finished_time = Time.now.utc finished_time_iso = finished_time.iso8601 @@ -68,11 +68,12 @@ context.state["FinishedTime"] ||= finished_time_iso context.state["Duration"] = finished_time - entered_time context.execution["EndTime"] = finished_time_iso if context.next_state.nil? - logger.info("Running state: [#{context.state_name}] with input [#{context.input}]...Complete - next state: [#{context.next_state}] output: [#{context.output}]") + level = context.output&.[]("Error") ? :error : :info + logger.public_send(level, "Running state: [#{long_name}] with input [#{context.input}]...Complete #{context.next_state ? "- next state [#{context.next_state}]" : "workflow -"} output: [#{context.output}]") context.state_history << context.state 0 end @@ -97,9 +98,13 @@ context.state["WaitUntil"] && Time.now.utc <= Time.parse(context.state["WaitUntil"]) end def wait_until context.state["WaitUntil"] && Time.parse(context.state["WaitUntil"]) + end + + def long_name + "#{self.class.name.split("::").last}:#{name}" end private def wait_until!(seconds: nil, time: nil)