# logs the callstack of the sql query by aliasing the methods in and out to not affect the performance # of regular statements # # options # :include => only log if the sql matches this regexp or string # :log_level => log level to log at. default to :debug # :sql_type => defaults to :execute (SELECT) also :insert, :delete and :update are available # # class GiraffeRoar # include LogSqlCaller # # def some_method # log_sql_caller(:sql_type => :execute, :include => 'SELECT count(*)') do # ... SOME AR stuff or whatever .. # end # end # end # # # Other examples # log inserts # log_sql_caller(:sql_type => insert, :include => /^INSERT/) {...} # # log all queries at warning level # log_sql_caller(:log_level => :warn) {...} #