Sha256: 9a3859bcfdcb525ecbe1f88d2ac49a71e35e6ca23ae2384ca9ed118b4fede66a

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

module Vizsla
  class RequestLogger
    def request_response_time(query_time)
      log "=" * 50
      log "Total request/response time: #{query_time} seconds."
      log "=" * 50
    end

    def log_events(events)
      if events.empty?
        log "=" * 50
        log "No data collected. Are you calling ActiveRecord at all?"
        log "=" * 50
      else
        events.keys.each do |event_name|
          log "=" * 50
          log events[event_name]
          log "=" * 50
        end
      end
    end

    private

    def rails_app?
      defined? ::Rails
    end

    def log(text)
      if rails_app?
        Rails.logger.debug text
      else
        puts text
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vizsla-0.0.6 lib/vizsla/logger.rb
vizsla-0.0.5 lib/vizsla/logger.rb
vizsla-0.0.4 lib/vizsla/logger.rb