def clear_logs
      ::RSpec.configure do |config|
        config.add_setting :clear_log_file
        config.clear_log_file = Rails.root.join('log', 'test.log') if defined?(Rails.root)
        config.add_setting :clear_log_file_proc
        config.clear_log_file_proc = ->(file) do
          next unless file && File.exist?(file)
          FileUtils.cp(file, "#{file}.last")
          File.open(file, 'w').close
        end
        config.after(:suite) do
          instance_exec(config.clear_log_file, &config.clear_log_file_proc) unless ENV['KEEP_LOG']
        end
      end
    end
def clear_logs
      ::RSpec.configure do |config|
        config.add_setting :clear_log_file
        config.clear_log_file = Rails.root.join('log', 'test.log') if defined?(Rails.root)
        config.add_setting :clear_log_file_proc
        config.clear_log_file_proc = ->(file) do
          next unless file && File.exist?(file)
          FileUtils.cp(file, "#{file}.last")
          File.open(file, 'w').close
        end
        config.after(:suite) do
          instance_exec(config.clear_log_file, &config.clear_log_file_proc) unless ENV['KEEP_LOG']
        end
      end
    end
Clear logs `tail -f`-safely.