Class: Logtail::Events::TemplateRender

Inherits:
Logtail::Event show all
Defined in:
lib/logtail/events/template_render.rb

Instance Attribute Summary collapse

Attributes inherited from Logtail::Event

#metadata

Instance Method Summary collapse

Methods inherited from Logtail::Event

#inspect, #to_json, #to_msgpack, #to_s

Constructor Details

#initialize(attributes) ⇒ TemplateRender

Returns a new instance of TemplateRender.



9
10
11
12
13
# File 'lib/logtail/events/template_render.rb', line 9

def initialize(attributes)
  @name = attributes[:name]
  @duration_ms = attributes[:duration_ms]
  @message = attributes[:message]
end

Instance Attribute Details

#duration_msObject (readonly)

Returns the value of attribute duration_ms.



7
8
9
# File 'lib/logtail/events/template_render.rb', line 7

def duration_ms
  @duration_ms
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/logtail/events/template_render.rb', line 7

def message
  @message
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/logtail/events/template_render.rb', line 7

def name
  @name
end

Instance Method Details

#to_hashObject



15
16
17
18
19
20
21
22
# File 'lib/logtail/events/template_render.rb', line 15

def to_hash
  {
    template_rendered: Util::NonNilHashBuilder.build do |h|
      h.add(:name, name)
      h.add(:duration_ms, duration_ms)
    end
  }
end