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-4.1.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-4.0.2 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-4.0.1 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-4.0.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-3.0.5 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-3.0.4 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-3.0.3 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-3.0.2 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-3.0.1 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-3.0.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.13.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.12.5 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.12.4 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.12.3 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.12.2 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.12.1 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.12.0 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.11.9 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.11.8 lib/cassandra_object/log_subscriber.rb
gotime-cassandra_object-2.11.7 lib/cassandra_object/log_subscriber.rb