Class: Gitlab::QA::SystemLogs::LogTypes::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/system_logs/log_types/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, data) ⇒ Log

Returns a new instance of Log.



8
9
10
11
# File 'lib/gitlab/qa/system_logs/log_types/log.rb', line 8

def initialize(name, data)
  @name = name
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



13
14
15
# File 'lib/gitlab/qa/system_logs/log_types/log.rb', line 13

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/gitlab/qa/system_logs/log_types/log.rb', line 13

def name
  @name
end

Instance Method Details

#summaryObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/gitlab/qa/system_logs/log_types/log.rb', line 24

def summary
  summary = {}

  summary_fields.each do |field|
    value = data[field]
    summary[field] = value unless value.nil?
  end

  summary
end

#summary_fieldsObject



15
16
17
18
19
20
21
22
# File 'lib/gitlab/qa/system_logs/log_types/log.rb', line 15

def summary_fields
  [
    :severity,
    :correlation_id,
    :time,
    :message
  ]
end