class Warren::Handler::Log
Class Warren::Log provides a dummy RabbitMQ connection pool for use during development
Constants
- Exchange
Small object to track exchange properties for logging purposes
Attributes
logger[R]
Public Class Methods
new(logger:, routing_key_prefix: nil)
click to toggle source
Calls superclass method
# File lib/warren/handler/log.rb, line 73 def initialize(logger:, routing_key_prefix: nil) super() @logger = logger @routing_key_template = Handler.routing_key_template(routing_key_prefix) end
Public Instance Methods
<<(message)
click to toggle source
Sends a message to the log channel. Useful if you only need to send one message.
@param [Warren::Message] message The message to broadcast. Must respond to routing_key and payload
@return [Warren::Log] Returns itself to allow chaining. But you're
probably better off using #with_channel in that case
# File lib/warren/handler/log.rb, line 104 def <<(message) with_channel { |c| c << message } end
new_channel()
click to toggle source
# File lib/warren/handler/log.rb, line 79 def new_channel Channel.new(@logger, routing_key_template: @routing_key_template) end
with_channel() { |new_channel| ... }
click to toggle source
Yields a Warren::Log::Channel
@return [void]
@yieldreturn [Warren::Log::Channel] A rabbitMQ channel that logs messaged to the test warren
# File lib/warren/handler/log.rb, line 90 def with_channel yield new_channel end