Sha256: faa05c875a92c29a34dda555b454a4fdf041199a2bc135a79a01253341383ae4
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require "logger" module JCukeForker class LoggingListener < AbstractListener TIME_FORMAT = "%Y-%m-%d %H:%M:%S" def initialize(io = STDOUT) @io = io end def on_run_starting log.info "[ run ] starting" end def on_worker_register(worker_path) log.info "[ worker #{worker_id(worker_path).ljust 3} ] register: #{worker_path}" end def on_worker_dead(worker_path) log.info "[ worker #{worker_id(worker_path).ljust 3} ] dead : #{worker_path}" end def on_task_starting(worker_path, feature) log.info "[ worker #{worker_id(worker_path).ljust 3} ] starting: #{feature}" end def on_task_finished(worker_path, feature, status) log.info "[ worker #{worker_id(worker_path).ljust 3} ] #{status_string(status).ljust(8)}: #{feature}" end def on_run_finished(failed) log.info "[ run ] finished, #{status_string failed}" end def on_run_interrupted puts "\n" log.info "[ run ] interrupted - please wait" end private def status_string(failed) failed == 'false' ? 'failed' : 'passed' end def worker_id(worker_path) /\-(\d+)$/.match(worker_path).captures[0] end def log @log ||= ( log = Logger.new @io log.datetime_format = TIME_FORMAT log ) end end # LoggingListener end # CukeForker
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jcukeforker-0.2.2 | lib/jcukeforker/logging_listener.rb |