Class: Datadog::CI::Logs::Component
- Inherits:
-
Object
- Object
- Datadog::CI::Logs::Component
- Defined in:
- lib/datadog/ci/logs/component.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
Instance Method Summary collapse
-
#initialize(enabled:, writer:) ⇒ Component
constructor
A new instance of Component.
- #shutdown! ⇒ Object
- #write(event) ⇒ Object
Constructor Details
#initialize(enabled:, writer:) ⇒ Component
Returns a new instance of Component.
11 12 13 14 |
# File 'lib/datadog/ci/logs/component.rb', line 11 def initialize(enabled:, writer:) @enabled = enabled && !writer.nil? @writer = writer end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
9 10 11 |
# File 'lib/datadog/ci/logs/component.rb', line 9 def enabled @enabled end |
Instance Method Details
#shutdown! ⇒ Object
25 26 27 |
# File 'lib/datadog/ci/logs/component.rb', line 25 def shutdown! @writer&.stop end |
#write(event) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/datadog/ci/logs/component.rb', line 16 def write(event) return unless enabled (event) @writer&.write(event) nil end |