Class: MemoryTracker::Stores::UrlLogfileStore

Inherits:
Base
  • Object
show all
Defined in:
lib/memory_tracker/stores/url_logfile_store.rb

Instance Method Summary collapse

Methods inherited from Base

#name, register_store

Constructor Details

#initialize(opts) ⇒ UrlLogfileStore

Returns a new instance of UrlLogfileStore.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/memory_tracker/stores/url_logfile_store.rb', line 6

def initialize(opts)
  logger_class = opts.fetch(:logger_class, 'Logger')
  filename     = opts.fetch(:filename, "#{Rails.root}/log/memtracker_urls.log")

  @logger = logger_class.constantize.new(filename)
  if @logger.respond_to?(:formatter)
    @logger.formatter = proc do |severity, datetime, progname, msg|
      "#{msg}\n"
    end
  end
end

Instance Method Details

#push(request) ⇒ Object



18
19
20
21
# File 'lib/memory_tracker/stores/url_logfile_store.rb', line 18

def push(request)
  @request = request
  write_request_log
end

#statsObject



23
24
# File 'lib/memory_tracker/stores/url_logfile_store.rb', line 23

def stats
end