lib/semantic_logger/appenders.rb in semantic_logger-4.5.0 vs lib/semantic_logger/appenders.rb in semantic_logger-4.6.0.beta1
- old
+ new
@@ -6,13 +6,12 @@
def initialize(logger = Processor.logger.dup)
@logger = logger
@logger.name = self.class.name
end
- def add(options, deprecated_level = nil, &block)
- options = options.is_a?(Hash) ? options.dup : convert_old_appender_args(options, deprecated_level)
- appender = SemanticLogger::Appender.factory(options, &block)
+ def add(**args, &block)
+ appender = SemanticLogger::Appender.factory(**args, &block)
self << appender
appender
end
def log(log)
@@ -62,28 +61,8 @@
rescue Exception => exc
logger.error "Failed to re-open appender: #{appender.inspect}", exc
end
end
logger.trace 'All appenders re-opened'
- end
-
- private
-
- # Backward compatibility
- def convert_old_appender_args(appender, level)
- options = {}
- options[:level] = level if level
-
- if appender.is_a?(String)
- options[:file_name] = appender
- elsif appender.is_a?(IO)
- options[:io] = appender
- elsif appender.is_a?(Symbol) || appender.is_a?(Subscriber)
- options[:appender] = appender
- else
- options[:logger] = appender
- end
- warn "[DEPRECATED] SemanticLogger.add_appender parameters have changed. Please use: #{options.inspect}"
- options
end
end
end