Module: Deadweight::Hijack

Defined in:
lib/deadweight/hijack.rb,
lib/deadweight/hijack/rails.rb

Defined Under Namespace

Modules: Rails

Class Method Summary collapse

Class Method Details

.redirect_output(log_file_prefix) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/deadweight/hijack.rb', line 3

def self.redirect_output(log_file_prefix)
  original_stdout, original_stderr = STDOUT.clone, STDERR.clone

  STDOUT.reopen(File.open("#{log_file_prefix}stdout.log", 'w'))
  STDERR.reopen(File.open("#{log_file_prefix}stderr.log", 'w'))

  [original_stdout, original_stderr]
end