lib/logstash-logger/device.rb in logstash-logger-0.12.0 vs lib/logstash-logger/device.rb in logstash-logger-0.13.0
- old
+ new
@@ -19,21 +19,11 @@
autoload :Balancer, 'logstash-logger/device/balancer'
autoload :MultiDelegator, 'logstash-logger/device/multi_delegator'
def self.new(opts)
opts = opts.dup
-
- if opts.is_a?(Array)
- # Multiple device configs supplied... create a MultiDelegator
- devices = opts.map{|opt| build_device(opt)}
- Device::MultiDelegator.new(*devices)
- elsif Hash
- # Create a single device
- build_device(opts)
- else
- raise ArgumentError, "Invalid device options: must be a Hash or an Array of Hashes"
- end
+ build_device(opts)
end
def self.build_device(opts)
if parsed_uri_opts = parse_uri_config(opts)
opts.delete(:uri)
@@ -61,11 +51,12 @@
when :redis then Redis
when :kafka then Kafka
when :io then IO
when :stdout then Stdout
when :stderr then Stderr
+ when :multi_delegator then MultiDelegator
when :balancer then Balancer
- else fail ArgumentError, 'Invalid type'
+ else fail ArgumentError, 'Invalid device type'
end
end
end
end