Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LogRouter
- def self.start(options, &blk)
- server_options = options['server']
- EM.epoll
- EM.run do
- trap("TERM") { stop }
- trap("INT") { stop }
- EventMachine::start_server(server_options[:host], server_options[:port],
- EventMachine::RequestRouter::Connection, options) do |c|
- c.on_data do |data|
- data
- end
- c.unbind do
- debug [:c_unbind]
- end
- end
- end
- end
- def self.stop
- EventMachine.stop
- end
- def self.debug(*data)
- require 'pp'
- pp data
- puts
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement