Commits

Kaspar Schiess committed 592b2af

Adds a verbose flag for the proxy

Comments (0)

Files changed (4)

lib/event_shipper/proxy.rb

   class Proxy < Clamp::Command
 
     option %w(-c --config), "FILE", "Location of the configuration file."
+    option %w(-v --verbose), :flag, "Prints all events before forwarding them."
 
     def execute
       fail "Please specify a configuration file to use on the command line. (--config)" \
         handle_message queue, message }
     end
     def handle_message queue, message
-      # puts message
+      puts message if verbose?
       redis.lpush queue, message
     end
 

lib/event_shipper/udp.rb

       @stats = Stats.new      
     end
 
+    def close
+      @socket.close
+    end
+
     def wrap filter
       @filters << filter
     end

spec/lib/event_shipper/proxy_spec.rb

       expect {
         proxy.main_loop
       }.to raise_error('quit!')
+
+      proxy.transport.close
     end
   end
 end

spec/lib/event_shipper/udp_spec.rb

     def en obj
       obj.tap { self.class.call_seq << @name }
     end
-    def de obj
-      obj.tap { self.class.call_seq << @name }
+    def de *args
+      args.tap { self.class.call_seq << @name }
     end
   end