lib/dry/monitor/sql/logger.rb in dry-monitor-0.3.2 vs lib/dry/monitor/sql/logger.rb in dry-monitor-0.4.0
- old
+ new
@@ -38,28 +38,24 @@
end
setting :theme, nil
setting :message_template, %( Loaded %s in %sms %s)
- attr_reader :config
- attr_reader :logger
- attr_reader :template
+ attr_reader :config, :logger, :template
load_extensions(:default_colorizer)
def initialize(logger, config = self.class.config)
@logger = logger
@config = config
@template = config.message_template
end
def subscribe(notifications)
- notifications.subscribe(:sql) do |time:, name:, query:|
- log_query(time, name, query)
- end
+ notifications.subscribe(:sql) { |params| log_query(**params) }
end
- def log_query(time, name, query)
+ def log_query(time:, name:, query:)
logger.info template % [name.inspect, time, colorizer.call(query)]
end
end
end
end