Module: Quandl::Cassandra::Base::Logging::ClassMethods

Defined in:
lib/quandl/cassandra/base/logging.rb

Instance Method Summary collapse

Instance Method Details

#execute(*args, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/quandl/cassandra/base/logging.rb', line 19

def execute(*args, &block)
  statement = args.first.to_s
  statement = "#{statement[0..200]} ... #{statement.length} chars" if statement.length > 200
  t1 = Time.now
  begin
    r = super if defined?(super)
  ensure
    Logger.debug("(#{t1.elapsed_ms}) ".blue + " #{statement}")
  end
  r
end

#prepare(*args, &block) ⇒ Object



12
13
14
15
16
17
# File 'lib/quandl/cassandra/base/logging.rb', line 12

def prepare(*args, &block)
  statement = args.first.to_s
  statement = "#{statement[0..200]} ... #{statement.length} chars" if statement.length > 200
  Logger.debug(statement)
  super if defined?(super)
end