Module: Gorgon::CrashReporter

Included in:
Listener, WorkerManager
Defined in:
lib/gorgon/crash_reporter.rb

Constant Summary collapse

OUTPUT_LINES_TO_REPORT =
70

Instance Method Summary collapse

Instance Method Details

#report_crash(reply_exchange, info) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/gorgon/crash_reporter.rb', line 5

def report_crash reply_exchange, info
  stdout = `tail -n #{OUTPUT_LINES_TO_REPORT} #{info[:out_file]}`
  stderr = `cat #{info[:err_file]}` + \
    info[:footer_text]

  send_crash_message reply_exchange, stdout, stderr

  "#{stdout}\n#{stderr}"
end

#send_crash_message(reply_exchange, output, error) ⇒ Object



15
16
17
18
19
# File 'lib/gorgon/crash_reporter.rb', line 15

def send_crash_message reply_exchange, output, error
  reply = {:type => :crash, :hostname => Socket.gethostname,
           :stdout => output, :stderr => error}
  reply_exchange.publish(Yajl::Encoder.encode(reply))
end