Sha256: def4cd63d0aafd4acb224de81dd639320209a721985bb5c05c909795ba561370
Contents?: true
Size: 615 Bytes
Versions: 34
Compression:
Stored size: 615 Bytes
Contents
module CassandraObject class LogSubscriber < ActiveSupport::LogSubscriber def initialize super @odd_or_even = false end def cql(event) payload = event.payload name = '%s (%.1fms)' % [payload[:name], event.duration] cql = payload[:cql].squeeze(' ') if odd? name = color(name, CYAN, true) cql = color(cql, nil, true) else name = color(name, MAGENTA, true) end debug " #{name} #{cql}" end def odd? @odd_or_even = !@odd_or_even end end end CassandraObject::LogSubscriber.attach_to :cassandra_object
Version data entries
34 entries across 34 versions & 2 rubygems