lib/semantic_logger/appender/bugsnag.rb in semantic_logger-3.4.1 vs lib/semantic_logger/appender/bugsnag.rb in semantic_logger-4.0.0.beta1

- old
+ new

@@ -25,21 +25,16 @@ # filter: [Regexp|Proc] # RegExp: Only include log messages where the class name matches the supplied. # regular expression. All other messages will be ignored. # Proc: Only include log messages where the supplied Proc returns true # The Proc must return true or false. - def initialize(options = {}, &block) - # Backward compatibility - options = {level: options} unless options.is_a?(Hash) - options = options.dup - options[:level] = :error unless options.has_key?(:level) + def initialize(level: :error, formatter: nil, filter: nil, host: SemanticLogger.host, application: SemanticLogger.application, &block) + raise 'Bugsnag only supports :info, :warn, or :error log levels' unless [:info, :warn, :error].include?(level) - raise 'Bugsnag only supports :info, :warn, or :error log levels' unless [:info, :warn, :error].include?(options[:level]) - # Replace the Bugsnag logger so that we can identify its log messages and not forward them to Bugsnag Bugsnag.configure { |config| config.logger = SemanticLogger[Bugsnag] } - super(options, &block) + super(level: level, formatter: formatter, filter: filter, host: host, application: application, &block) end # Returns [Hash] of parameters to send to Bugsnag. def call(log, logger) h = log.to_h(host, application)