You should use the Ruby on Rails logger block syntax

Finding Postgres rows too large for BTree indexes

Buffer analysis when using EXPLAIN ANALYSE in Postgres