lib/bolt/executor.rb in bolt-0.21.6 vs lib/bolt/executor.rb in bolt-0.21.7

- old
+ new

@@ -132,9 +132,25 @@ @logger.send(log_method, "Finished: #{description} with #{failures} failure#{plural} in #{duration.round(2)} sec") results end + def log_plan(plan_name) + log_method = @plan_logging ? :notice : :info + @logger.send(log_method, "Starting: plan #{plan_name}") + start_time = Time.now + + results = nil + begin + results = yield + ensure + duration = Time.now - start_time + @logger.send(log_method, "Finished: plan #{plan_name} in #{duration.round(2)} sec") + end + + results + end + def report_transport(transport, count) name = transport.class.name.split('::').last.downcase @analytics&.event('Transport', 'initialize', name, count) unless @reported_transports.include?(name) @reported_transports.add(name) end