class Daemons::Reporter

def backtrace_not_supported

def backtrace_not_supported 
  output_message 'option :backtrace is not supported with :mode => :exec, ignoring'
end

def cannot_stop_process(app_name, pid)

def cannot_stop_process(app_name, pid)
  output_message "#{app_name}: unable to forcefully kill process with pid #{pid}."
  $stdout.flush
end

def changing_process_privilege(user, group = user)

def changing_process_privilege(user, group = user)
  output_message "Changing process privilege to #{user}:#{group}"
end

def deleted_found_pidfile(pid, f)

def deleted_found_pidfile(pid, f)
  output_message "pid-file for killed process #{pid} found (#{f}), deleting."
end

def initialize(options)

def initialize(options)
  @options = options
  if !options[:shush]
    $stdout.sync = true
  end
end

def output_message(message)

def output_message(message)
  if !options[:shush]
    puts message
  end
end

def process_started(app_name, pid)

def process_started(app_name, pid)
  output_message  "#{app_name}: process with pid #{pid} started."
end

def status(app_name, running, pid_exists, pid)

def status(app_name, running, pid_exists, pid)
  output_message "#{app_name}: #{running ? '' : 'not '}running#{(running and pid_exists) ? ' [pid ' + pid.to_s + ']' : ''}#{(pid_exists and not running) ? ' (but pid-file exists: ' + pid.to_s + ')' : ''}"
end

def stopped_process(app_name, pid)

def stopped_process(app_name, pid)
  output_message "#{app_name}: process with pid #{pid} successfully stopped."
  $stdout.flush
end

def stopping_process(app_name, pid, sig, wait)

def stopping_process(app_name, pid, sig, wait)
  output_message "#{app_name}: trying to stop process with pid #{pid}#{' forcefully :(' if sig == 'KILL'} sending #{sig} and waiting #{wait}s ..."
  $stdout.flush
end