Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (20 sloc) 0.706 kB
require 'securerandom'
require 'active_support/notifications'
require 'active_support/log_subscriber'
module Cassanity
module Instrumentation
class LogSubscriber < ::ActiveSupport::LogSubscriber
def cql(event)
return unless logger.debug?
name = '%s (%.1fms)' % ["CQL Query", event.duration]
cql = event.payload[:cql]
vars = event.payload[:cql_variables] || []
variables = vars.map { |var| var.inspect }.join(', ')
query = "#{cql}"
query += " (#{variables})" unless variables.empty?
debug " #{color(name, CYAN, true)} [ #{query} ]"
end
end
end
end
Cassanity::Instrumentation::LogSubscriber.attach_to :cassanity
Jump to Line
Something went wrong with that request. Please try again.