class Puma::Runner

def redirect_io

def redirect_io
  stdout = @options[:redirect_stdout]
  stderr = @options[:redirect_stderr]
  append = @options[:redirect_append]
  if stdout
    ensure_output_directory_exists(stdout, 'STDOUT')
    STDOUT.reopen stdout, (append ? "a" : "w")
    STDOUT.puts "=== puma startup: #{Time.now} ==="
    STDOUT.flush unless STDOUT.sync
  end
  if stderr
    ensure_output_directory_exists(stderr, 'STDERR')
    STDERR.reopen stderr, (append ? "a" : "w")
    STDERR.puts "=== puma startup: #{Time.now} ==="
    STDERR.flush unless STDERR.sync
  end
  if @options[:mutate_stdout_and_stderr_to_sync_on_write]
    STDOUT.sync = true
    STDERR.sync = true
  end
end