Class: Warren::Handler::Log::Channel
- Inherits:
-
Object
- Object
- Warren::Handler::Log::Channel
- Defined in:
- lib/warren/handler/log.rb
Overview
Mimics a Broadcast::Channel but instead passes out to a logger
Instance Method Summary collapse
-
#<<(message) ⇒ Warren::Handler::Broadcast::Channel
Logs ‘message` to the configured logger.
- #exchange(name, options) ⇒ Object
-
#initialize(logger, routing_key_template: '%s') ⇒ Channel
constructor
A new instance of Channel.
-
#prefetch(number) ⇒ Object
NOOP - Provided for API compatibility.
- #queue(name, options) ⇒ Object
Constructor Details
#initialize(logger, routing_key_template: '%s') ⇒ Channel
Returns a new instance of Channel.
12 13 14 15 |
# File 'lib/warren/handler/log.rb', line 12 def initialize(logger, routing_key_template: '%s') @logger = logger @routing_key_template = routing_key_template end |
Instance Method Details
#<<(message) ⇒ Warren::Handler::Broadcast::Channel
Logs ‘message` to the configured logger
24 25 26 27 28 |
# File 'lib/warren/handler/log.rb', line 24 def <<() @logger.info "Published: #{key_for(message)}" @logger.debug "Payload: #{message.payload}" self end |
#exchange(name, options) ⇒ Object
30 31 32 33 |
# File 'lib/warren/handler/log.rb', line 30 def exchange(name, ) @logger.debug "Declared exchange: #{name}, #{options.inspect}" Exchange.new(name, ) end |
#prefetch(number) ⇒ Object
NOOP - Provided for API compatibility
41 |
# File 'lib/warren/handler/log.rb', line 41 def prefetch(number); end |
#queue(name, options) ⇒ Object
35 36 37 38 |
# File 'lib/warren/handler/log.rb', line 35 def queue(name, ) @logger.debug "Declared queue: #{name}, #{options.inspect}" Queue.new(@logger, name) end |