lib/sequel_rails/railties/log_subscriber.rb in sequel-rails-0.7.0 vs lib/sequel_rails/railties/log_subscriber.rb in sequel-rails-0.8.0
- old
+ new
@@ -1,16 +1,14 @@
module SequelRails
module Railties
-
class LogSubscriber < ActiveSupport::LogSubscriber
-
def self.runtime=(value)
- Thread.current["sequel_sql_runtime"] = value
+ Thread.current['sequel_sql_runtime'] = value
end
def self.runtime
- Thread.current["sequel_sql_runtime"] ||= 0
+ Thread.current['sequel_sql_runtime'] ||= 0
end
def self.reset_runtime
rt, self.runtime = runtime, 0
rt
@@ -20,18 +18,18 @@
self.class.runtime += event.duration
return unless logger.debug?
payload = event.payload
- name = '%s (%.1fms)' % [payload[:name], event.duration]
+ name = sprintf('%s (%.1fms)', payload[:name], event.duration)
sql = payload[:sql].squeeze(' ')
binds = nil
unless (payload[:binds] || []).empty?
- binds = " " + payload[:binds].map { |col,v|
+ binds = ' ' + payload[:binds].map do |col, v|
[col.name, v]
- }.inspect
+ end.inspect
end
if odd?
name = color(name, :cyan, true)
sql = color(sql, nil, true)
@@ -47,10 +45,8 @@
end
def logger
::SequelRails.configuration.logger
end
-
end
-
end
end