Class: CD4PETaskLogger
- Inherits:
-
Object
- Object
- CD4PETaskLogger
- Defined in:
- lib/puppet_x/puppetlabs/cd4pe_task_logger.rb
Overview
Class to track logs + timestamps. To be returned as part of the Bolt log output
Instance Attribute Summary collapse
-
#logs ⇒ Object
readonly
Returns the value of attribute logs.
Instance Method Summary collapse
-
#initialize ⇒ CD4PETaskLogger
constructor
A new instance of CD4PETaskLogger.
- #log(log) ⇒ Object
Constructor Details
#initialize ⇒ CD4PETaskLogger
Returns a new instance of CD4PETaskLogger.
4 5 6 |
# File 'lib/puppet_x/puppetlabs/cd4pe_task_logger.rb', line 4 def initialize @logs = [] end |
Instance Attribute Details
#logs ⇒ Object (readonly)
Returns the value of attribute logs.
3 4 5 |
# File 'lib/puppet_x/puppetlabs/cd4pe_task_logger.rb', line 3 def logs @logs end |
Instance Method Details
#log(log) ⇒ Object
8 9 10 |
# File 'lib/puppet_x/puppetlabs/cd4pe_task_logger.rb', line 8 def log(log) @logs.push(timestamp: Time.now.getutc, message: log) end |