Class: RabbitmqClient::LoggerBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbitmq_client/logger_builder.rb

Overview

ExchangeRegistry is a store for all managed exchanges and their details

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ LoggerBuilder

Returns a new instance of LoggerBuilder.



6
7
8
9
10
11
# 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

Instance Method Details

#build_loggerObject



13
14
15
16
17
18
19
# 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