class SimpleWorker::LoggingListener

Constants

TIME_FORMAT

Public Class Methods

new(io = STDOUT) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 7
def initialize(io = STDOUT)
  @io = io
end

Public Instance Methods

on_interrupted() click to toggle source
# File lib/simpleworker/logging_listener.rb, line 47
def on_interrupted
  log.info "interrupted"
end
on_log(hostname, msg) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 43
def on_log(hostname, msg)
  log.info "host: #{hostname} #{msg}"
end
on_node_start(hostname) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 19
def on_node_start(hostname)
  log.info "start node: #{hostname}"
end
on_node_stop(hostname) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 23
def on_node_stop(hostname)
  log.info "stop node: #{hostname}"
end
on_start(jobid) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 11
def on_start(jobid)
  log.info "start: #{jobid}"
end
on_stop() click to toggle source
# File lib/simpleworker/logging_listener.rb, line 15
def on_stop
  log.info "stop"
end
on_task_active(hostname, task) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 31
def on_task_active(hostname, task)
  log.info "active host: #{hostname} task: #{task}"
end
on_task_expire(hostname, task) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 39
def on_task_expire(hostname, task)
  log.info "expire host: #{hostname} task: #{task}"
end
on_task_start(hostname, task) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 27
def on_task_start(hostname, task)
  log.info "start host: #{hostname} task: #{task}"
end
on_task_stop(hostname, task) click to toggle source
# File lib/simpleworker/logging_listener.rb, line 35
def on_task_stop(hostname, task)
  log.info "stop host: #{hostname} task: #{task}"
end
on_timeout() click to toggle source
# File lib/simpleworker/logging_listener.rb, line 51
def on_timeout
  log.info "timeout"
end

Private Instance Methods

log() click to toggle source
# File lib/simpleworker/logging_listener.rb, line 57
def log
  @log ||= (
    log = ::Logger.new @io
    log.datetime_format = TIME_FORMAT
    log
  )
end