Class: RightScale::AuditFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/right_agent/audit_formatter.rb

Overview

Standard formatter for audit entries Each method return a hash of two elements:

- :summary contains the updated summary of the audit entry
- :detail contains the details to be appended to the audit entry

Class Method Summary collapse

Class Method Details

.error(text) ⇒ Object

Append error text to current audit section

Parameters

text(String)

Error message to be appended

Return

entry(Hash)

Hash containing new audit entry detail



84
85
86
# File 'lib/right_agent/audit_formatter.rb', line 84

def self.error(text)
  entry = { :detail => "*ERROR> #{text}\n" }
end

.info(text) ⇒ Object

Append info text to current audit section

Parameters

info(String)

Information to be appended

Return

entry(Hash)

Hash containing new audit entry detail



73
74
75
# File 'lib/right_agent/audit_formatter.rb', line 73

def self.info(text)
  entry = { :detail => wrap_text(text) }
end

.new_section(title) ⇒ Object

Start new audit section

Parameters

title(String)

New section title

Return

entry(Hash)

Hash containing new audit entry summary and detail



38
39
40
41
# File 'lib/right_agent/audit_formatter.rb', line 38

def self.new_section(title)
  title = '' unless title
  entry = { :summary => title, :detail => "#{ '****' * 20 }\n*RS>#{ title.center(72) }****\n" }
end

.output(text) ⇒ Object

Append output to current audit section

Parameters

text(String)

Output to be appended

Return

entry(Hash)

Hash containing new audit entry detail



61
62
63
64
# File 'lib/right_agent/audit_formatter.rb', line 61

def self.output(text)
  text += "\n" unless text[-1, 1] == "\n"
  entry = { :detail => text }
end

.status(status) ⇒ Object

Update audit summary

Parameters

status(String)

Updated audit status

Return

entry(Hash)

Hash containing new audit entry summary and detail



50
51
52
# File 'lib/right_agent/audit_formatter.rb', line 50

def self.status(status)
  entry = { :summary => status, :detail => wrap_text(status) }
end