Class: VcoWorkflows::WorkflowExecutionLog
- Inherits:
-
Object
- Object
- VcoWorkflows::WorkflowExecutionLog
- Defined in:
- lib/vcoworkflows/workflowexecutionlog.rb
Overview
WorkflowExecutionLog is a simple object to contain the log for an execution of a workflow.
Instance Attribute Summary collapse
-
#messages ⇒ String[]
readonly
Log messages.
Instance Method Summary collapse
-
#initialize(log_json) ⇒ VcoWorkflows::WorkflowExecutionLog
constructor
Create an execution log object.
-
#to_s ⇒ String
Stringify the log.
Constructor Details
#initialize(log_json) ⇒ VcoWorkflows::WorkflowExecutionLog
Create an execution log object
16 17 18 19 20 21 |
# File 'lib/vcoworkflows/workflowexecutionlog.rb', line 16 def initialize(log_json) = {} JSON.parse(log_json)['logs'].each do |log_entry| [log_entry['entry']['time-stamp']] = log_entry['entry'] end end |
Instance Attribute Details
#messages ⇒ String[] (readonly)
Log messages
11 12 13 |
# File 'lib/vcoworkflows/workflowexecutionlog.rb', line 11 def end |
Instance Method Details
#to_s ⇒ String
Stringify the log
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vcoworkflows/workflowexecutionlog.rb', line 27 def to_s = '' .keys.sort.each do || << "#{Time.at(timestamp / 1000)}" << " #{@messages[timestamp]['severity']}: #{@messages[timestamp]['user']}:" << " #{@messages[timestamp]['short-description']}" unless []['short-description'].eql?([]['long-description']) << "; #{@messages[timestamp]['long-description']}" end << "\n" end end |