lib/sapience/configuration.rb in sapience-1.0.15 vs lib/sapience/configuration.rb in sapience-2.0.0

- old
+ new

@@ -1,24 +1,24 @@ require "ostruct" module Sapience - UnkownLogLevel = Class.new(StandardError) - InvalidLogExecutor = Class.new(StandardError) # rubocop:disable ClassVars class Configuration attr_reader :default_level, :backtrace_level, :backtrace_level_index attr_writer :host - attr_accessor :app_name, :ap_options, :appenders, :log_executor, :filter_parameters + attr_accessor :app_name, :ap_options, :appenders, :log_executor, :filter_parameters, :metrics, :error_handler SUPPORTED_EXECUTORS = %i(single_thread_executor immediate_executor).freeze DEFAULT = { log_level: :info, host: nil, ap_options: { multiline: false }, appenders: [{ stream: { io: STDOUT, formatter: :color } }], log_executor: :single_thread_executor, + metrics: { datadog: { url: Sapience::DEFAULT_STATSD_URL } }, + error_handler: { silent: {} }, filter_parameters: %w(password password_confirmation), }.freeze # Initial default Level for all new instances of Sapience::Logger def initialize(options = {}) # rubocop:disable AbcSize @@ -32,9 +32,11 @@ self.app_name = @options[:app_name] self.ap_options = @options[:ap_options] self.appenders = @options[:appenders] self.log_executor = @options[:log_executor] self.filter_parameters = @options[:filter_parameters] + self.metrics = @options[:metrics] + self.error_handler = @options[:error_handler] end # Sets the global default log level def default_level=(level) @default_level = level