Class: CD4PETaskLogger

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeCD4PETaskLogger

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

#logsObject (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