class PG::Connection::GeneralLog::Logger

Public Instance Methods

push(sql, args, backtrace, time) click to toggle source
Calls superclass method
# File lib/pg/connection/general_log/logger.rb, line 19
def push(sql, args, backtrace, time)
  super(Log.new(sql, args, backtrace, time))
end
writefile(req) click to toggle source
# File lib/pg/connection/general_log/logger.rb, line 8
def writefile(req)
  FileUtils.mkdir_p(Middleware.path)
  File.open(File.join(Middleware.path, "#{Date.today}.txt"), 'a') do |file|
    if req
      file.puts "REQUEST\t#{req.request_method}\t#{req.fullpath}\t#{self.length}"
    end

    file.puts self.map { |log| log.format(Middleware.backtrace) }.join("\n") + "\n\n"
  end
end