lib/semantic_logger/appender.rb in semantic_logger-4.2.0 vs lib/semantic_logger/appender.rb in semantic_logger-4.2.1
- old
+ new
@@ -59,27 +59,25 @@
else
appender
end
end
- private
+ ASYNC_OPTION_KEYS = %i[max_queue_size lag_threshold_s batch_size batch_seconds lag_check_interval].freeze
- ASYNC_OPTION_KEYS = [:max_queue_size, :lag_threshold_s, :batch_size, :batch_seconds, :lag_check_interval]
-
# Returns [Subscriber] instance from the supplied options.
def self.build(options, &block)
if options[:io] || options[:file_name]
SemanticLogger::Appender::File.new(options, &block)
- elsif appender = options.delete(:appender)
+ elsif (appender = options.delete(:appender))
if appender.is_a?(Symbol)
SemanticLogger::Utils.constantize_symbol(appender).new(options)
elsif appender.is_a?(Subscriber)
appender
else
raise(ArgumentError, "Parameter :appender must be either a Symbol or an object derived from SemanticLogger::Subscriber, not: #{appender.inspect}")
end
- elsif appender = options.delete(:metric)
+ elsif (appender = options.delete(:metric))
if appender.is_a?(Symbol)
SemanticLogger::Utils.constantize_symbol(appender, 'SemanticLogger::Metric').new(options)
elsif appender.is_a?(Subscriber)
appender
else
@@ -88,7 +86,8 @@
elsif options[:logger]
SemanticLogger::Appender::Wrapper.new(options, &block)
end
end
+ private_class_method :build
end
end