class LogWorker < Packet::Worker
  set_worker_name :log_worker
  #set_no_auto_load(true)
  attr_accessor :log_file
  def worker_init
    @log_file = Logger.new("#{Merb.root}/log/backgroundrb_#{CONFIG_FILE[:backgroundrb][:port]}.log")
  end

  def receive_data p_data
    case p_data[:type]
    when :request: process_request(p_data)
    when :response: process_response(p_data)
    end
  end

  def process_request(p_data)
    log_data = p_data[:data]
    @log_file.info(log_data)
  end

  def process_response
    puts "Not implemented and needed"
  end
end


