Sha256: c1a866bc937d3e90fed503b614845b14855f8092161cb585657f62e2c30d560a

Contents?: true

Size: 1.59 KB

Versions: 6

Compression:

Stored size: 1.59 KB

Contents

module Daemons
  class Reporter
    attr_reader :options

    def initialize(options)
      @options = options

      if !options[:shush]
        $stdout.sync = true
      end
    end

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

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

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

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

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

    def stopping_process(app_name, pid)
      output_message "#{app_name}: trying to stop process with pid #{pid}..."
    end

    def forcefully_stopping_process(app_name, pid)
      output_message "#{app_name}: process with pid #{pid} won't stop, we forcefully kill it..." 
    end

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

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

    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
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
daemons-1.3.1 lib/daemons/reporter.rb
daemons-1.3.0 lib/daemons/reporter.rb
daemons-1.2.6 lib/daemons/reporter.rb
daemons-1.2.5 lib/daemons/reporter.rb
arcabouco-0.2.13 vendor/bundle/gems/daemons-1.2.4/lib/daemons/reporter.rb
daemons-1.2.4 lib/daemons/reporter.rb