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



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

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



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

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