Class: Semlogr::Events::LogEvent
- Inherits:
-
Object
- Object
- Semlogr::Events::LogEvent
- Defined in:
- lib/semlogr/events/log_event.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #add_property(properties) ⇒ Object
- #get_property(name) ⇒ Object
-
#initialize(severity, template, error, properties) ⇒ LogEvent
constructor
A new instance of LogEvent.
- #render(output) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(severity, template, error, properties) ⇒ LogEvent
Returns a new instance of LogEvent.
10 11 12 13 14 15 16 |
# File 'lib/semlogr/events/log_event.rb', line 10 def initialize(severity, template, error, properties) = Time.now.utc @severity = severity @template = template @error = error @properties = properties end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
6 7 8 |
# File 'lib/semlogr/events/log_event.rb', line 6 def error @error end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
7 8 9 |
# File 'lib/semlogr/events/log_event.rb', line 7 def properties @properties end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
4 5 6 |
# File 'lib/semlogr/events/log_event.rb', line 4 def severity @severity end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
5 6 7 |
# File 'lib/semlogr/events/log_event.rb', line 5 def template @template end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
8 9 10 |
# File 'lib/semlogr/events/log_event.rb', line 8 def end |
Instance Method Details
#add_property(properties) ⇒ Object
22 23 24 |
# File 'lib/semlogr/events/log_event.rb', line 22 def add_property(properties) @properties.merge!(properties) end |
#get_property(name) ⇒ Object
18 19 20 |
# File 'lib/semlogr/events/log_event.rb', line 18 def get_property(name) @properties[name] end |
#render(output) ⇒ Object
26 27 28 |
# File 'lib/semlogr/events/log_event.rb', line 26 def render(output) @template.render(output, @properties) end |
#to_s ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/semlogr/events/log_event.rb', line 30 def to_s output = '' render(output) output end |