Class: HP::Cloud::Log
- Inherits:
-
Object
- Object
- HP::Cloud::Log
- Defined in:
- lib/hpcloud/log.rb
Instance Method Summary collapse
- #display(message) ⇒ Object
- #error(err, exit_status = :general_error) ⇒ Object
- #fatal(err, exit_status = :general_error) ⇒ Object
-
#initialize(shell) ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize(shell) ⇒ Log
Returns a new instance of Log.
25 26 27 28 |
# File 'lib/hpcloud/log.rb', line 25 def initialize(shell) @silence_display = nil @shell = shell end |
Instance Method Details
#display(message) ⇒ Object
50 51 52 |
# File 'lib/hpcloud/log.rb', line 50 def display() @shell.say unless @silence_display end |
#error(err, exit_status = :general_error) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hpcloud/log.rb', line 35 def error(err, exit_status = :general_error) if err.kind_of?(String) = err else if err.kind_of?(CliStatus) exit_status = err.error_code = err.to_s else = ErrorResponse.new(err).to_s end end $stderr.puts @shell.exit_status.set(exit_status) end |
#fatal(err, exit_status = :general_error) ⇒ Object
30 31 32 33 |
# File 'lib/hpcloud/log.rb', line 30 def fatal(err, exit_status = :general_error) error(err, exit_status) exit @shell.exit_status.get end |