Having a level helps
This commit is contained in:
parent
d418a7ae38
commit
19350d73ca
@ -8,6 +8,8 @@ import org.jruby.RubyString
|
||||
|
||||
class Sylvilagus::Ch03::LogListeners
|
||||
class LogConsumer < DefaultConsumer
|
||||
attr_accessor :level
|
||||
|
||||
def handleDelivery(consumer_tag, envelope, properties, body)
|
||||
body_string = RubyString.bytes_to_string(body)
|
||||
puts "#{level}: #{body_string}"
|
||||
@ -45,8 +47,11 @@ class Sylvilagus::Ch03::LogListeners
|
||||
channel.queue_bind(info_queue, 'amq.rabbitmq.log', 'info')
|
||||
|
||||
errors_consumer = LogConsumer.new(channel)
|
||||
errors_consumer.level = 'error'
|
||||
warnings_consumer = LogConsumer.new(channel)
|
||||
warnings_consumer.level = 'warning'
|
||||
info_consumer = LogConsumer.new(channel)
|
||||
info_consumer.level = 'info'
|
||||
|
||||
puts 'Setting up consumers...'
|
||||
channel.basic_consume(errors_queue, false, errors_consumer)
|
||||
|
Loading…
Reference in New Issue
Block a user