class RabbitmqClient::LoggerBuilder
ExchangeRegistry
is a store for all managed exchanges and their details
Public Class Methods
new(config)
click to toggle source
# File lib/rabbitmq_client/logger_builder.rb, line 6 def initialize(config) @logger = config[:logger].clone @format = config[:logs_format] @level = config[:logs_level].to_sym @filename = config[:logs_filename] end
Public Instance Methods
build_logger()
click to toggle source
# File lib/rabbitmq_client/logger_builder.rb, line 13 def build_logger @logger ||= ::Logger.new(@filename || STDOUT) @logger.level = @level @logger.formatter = create_logger_formatter log_subscriber.attach_to(:rabbitmq_client) @logger end
Private Instance Methods
create_logger_formatter()
click to toggle source
# File lib/rabbitmq_client/logger_builder.rb, line 23 def create_logger_formatter json? ? JsonFormatter.new : TextFormatter.new end
json?()
click to toggle source
# File lib/rabbitmq_client/logger_builder.rb, line 31 def json? __method__.to_s == "#{@format}?" end
log_subscriber()
click to toggle source
# File lib/rabbitmq_client/logger_builder.rb, line 27 def log_subscriber json? ? JsonLogSubscriber : PlainLogSubscriber end