Class: Selenium::WebDriver::LogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/log_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level, timestamp, message) ⇒ LogEntry

Returns a new instance of LogEntry.


6
7
8
9
10
# File 'lib/selenium/webdriver/common/log_entry.rb', line 6

def initialize(level, timestamp, message)
  @level      = level
  @timestamp = timestamp
  @message    = message
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level


4
5
6
# File 'lib/selenium/webdriver/common/log_entry.rb', line 4

def level
  @level
end

#messageObject (readonly)

Returns the value of attribute message


4
5
6
# File 'lib/selenium/webdriver/common/log_entry.rb', line 4

def message
  @message
end

#timestampObject (readonly)

Returns the value of attribute timestamp


4
5
6
# File 'lib/selenium/webdriver/common/log_entry.rb', line 4

def timestamp
  @timestamp
end

Instance Method Details

#as_json(opts = nil) ⇒ Object


12
13
14
15
16
17
18
# File 'lib/selenium/webdriver/common/log_entry.rb', line 12

def as_json(opts = nil)
  {
    'level'     => level,
    'timestamp' => timestamp,
    'message'   => message
  }
end

#timeObject


24
25
26
# File 'lib/selenium/webdriver/common/log_entry.rb', line 24

def time
  Time.at timestamp / 1000
end

#to_sObject


20
21
22
# File 'lib/selenium/webdriver/common/log_entry.rb', line 20

def to_s
  "#{level} #{time}: #{message}"
end