Sha256: 98c4ee9e78dffb20cb58094e5b36fb2f145aee5472267960eeb144caf72fb113

Contents?: true

Size: 1.23 KB

Versions: 96

Compression:

Stored size: 1.23 KB

Contents

module CassandraObject
  class LogSubscriber < ActiveSupport::LogSubscriber
    def multi_get(event)
      name = '%s multi_get (%.1fms)' % [event.payload[:column_family], event.duration]

      debug "  #{name}  (#{event.payload[:keys].size}) #{event.payload[:keys].join(" ")}"
    end

    def remove(event)
      name = '%s remove (%.1fms)' % [event.payload[:column_family], event.duration]

      message = "  #{name}  #{event.payload[:key]}"
      message << " #{Array(event.payload[:attributes]).inspect}" if event.payload[:attributes]

      debug message
    end

    def truncate(event)
      name = '%s truncate (%.1fms)' % [event.payload[:column_family], event.duration]

      debug "  #{name}  #{event.payload[:column_family]}"
    end

    def insert(event)
      name = '%s insert (%.1fms)' % [event.payload[:column_family], event.duration]

      debug "  #{name}  #{event.payload[:key]} #{event.payload[:attributes].inspect}"
    end

    def get_range(event)
      name = '%s get_range (%.1fms)' % [event.payload[:column_family], event.duration]
      
      debug "  #{name}  (#{event.payload[:count]}) '#{event.payload[:start]}' => '#{event.payload[:finish]}'"
    end
  end
end
CassandraObject::LogSubscriber.attach_to :cassandra_object

Version data entries

96 entries across 96 versions & 2 rubygems

Version Path
gotime-cassandra_object-2.7.1 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.7.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.6.4 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.6.3 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.6.2 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.6.1 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.6.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.5.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.4.2 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.4.1 lib/cassandra_object/log_subscriber.rb
sessionm-cassandra_object-2.2.18 lib/cassandra_object/log_subscriber.rb
sessionm-cassandra_object-2.2.16 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.4.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.3.6 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.3.5 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.3.4 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.3.3 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.3.2 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.3.1 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.3.0 lib/cassandra_object/log_subscriber.rb