do start_time = DateTime.utc_now IO.puts "starting to #{unquote(message)} at #{DateTime.to_iso8601 start_time}" unquote(action) end_time = DateTime.utc_now IO.puts "finished at #{DateTime.to_iso8601 end_time}" duration = DateTime.to_unix(end_time, :microsecond) - DateTime.to_unix(start_time, :microsecond) IO.puts "Duration: #{duration} microseconds" end end end