Class: SlowActions::LogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/slow_actions/slow_actions_log_entry.rb

Overview

Object representing a single entry in a rails application’s log file

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogEntry

Create a new #LogEntry



6
7
8
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 6

def initialize
  self.processed = false
end

Instance Attribute Details

#actionObject

The #Action



12
13
14
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 12

def action
  @action
end

#controllerObject

The #Controller



10
11
12
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 10

def controller
  @controller
end

#dateObject

date



16
17
18
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 16

def date
  @date
end

#dbObject

time spent in the database



30
31
32
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 30

def db
  @db
end

#durationObject

Total duration to complete



26
27
28
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 26

def duration
  @duration
end

#error_textObject

error text (if any)



32
33
34
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 32

def error_text
  @error_text
end

#ipObject

IP address of user



14
15
16
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 14

def ip
  @ip
end

#methodObject

HTTP Method



20
21
22
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 20

def method
  @method
end

#parametersObject

Parameters to the action



24
25
26
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 24

def parameters
  @parameters
end

#processedObject

whether or not is has already been processed by #SlowActions



34
35
36
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 34

def processed
  @processed
end

#renderingObject

time spent rendering



28
29
30
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 28

def rendering
  @rendering
end

#sessionObject

Session ID



22
23
24
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 22

def session
  @session
end

#timeObject

time



18
19
20
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 18

def time
  @time
end

Instance Method Details

#error?Boolean

Whether or not this #LogEntry was an error

Returns:

  • (Boolean)


37
38
39
40
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 37

def error?
  return false if error_text.nil? or error_text.empty?
  return true
end

#to_sObject



42
43
44
# File 'lib/slow_actions/slow_actions_log_entry.rb', line 42

def to_s
  "#{date} #{time} #{method} #{controller}##{action} #{parameters}"
end