examples/mq/logger.rb in amqp-0.6.0 vs examples/mq/logger.rb in amqp-0.6.4
- old
+ new
@@ -2,11 +2,11 @@
require 'mq'
require 'mq/logger'
Logger = MQ::Logger
-EM.run{
+AMQP.start(:host => 'localhost') do
if ARGV[0] == 'server'
MQ.queue('logger').bind(MQ.fanout('logging', :durable => true)).subscribe{|msg|
msg = Marshal.load(msg)
require 'pp'
@@ -35,11 +35,11 @@
log.debug 'login', :session => 'abc', :user => 123
log = Logger.new(:webserver, :timestamp, :hostname, &log.printer)
log.info 'Request for /', :GET, :session => 'abc'
- AMQP.stop{ EM.stop_event_loop }
+ AMQP.stop{ EM.stop }
else
puts
puts "#{$0} <client|server>"
@@ -48,10 +48,10 @@
puts
EM.stop
end
-}
+end
__END__
{:data=>"123", :timestamp=>1216846102, :severity=>:info}