Sha256: 17e0dfe41628e33e2ef6ff6debff25ea3e6a5da21460033e148f3b7789ea30d7

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

class SlowActions
  private
  # Object representing a single entry in a rails application's log file
  class LogEntry
    # Create a new #LogEntry
    def initialize
      self.processed = false
    end
    # The #Controller
    attr_accessor :controller
    # The #Action
    attr_accessor :action
    # IP address of user
    attr_accessor :ip
    # date
    attr_accessor :date
    # time
    attr_accessor :time
    # HTTP Method
    attr_accessor :method
    # Session ID
    attr_accessor :session
    # Parameters to the action
    attr_accessor :parameters
    # Total duration to complete
    attr_accessor :duration
    # time spent rendering
    attr_accessor :rendering
    # time spent in the database
    attr_accessor :db
    # error text (if any)
    attr_accessor :error_text
    # whether or not is has already been processed by #SlowActions
    attr_accessor :processed

    # Whether or not this #LogEntry was an error
    def error?
      return false if error_text.nil? or error_text.empty?
      return true
    end
    
    def to_s
      "#{date} #{time} #{method} #{controller}##{action} #{parameters}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slow-actions-0.3.4 lib/slow_actions/slow_actions_log_entry.rb
slow-actions-0.3.3 lib/slow_actions/slow_actions_log_entry.rb