Class: RightScaleCLI::Logger
- Inherits:
-
Object
- Object
- RightScaleCLI::Logger
- Defined in:
- lib/rightscale_cli/logger.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
Returns the value of attribute log.
Instance Method Summary collapse
- #debug(msg) ⇒ Object
- #error(msg) ⇒ Object
- #info(msg) ⇒ Object
- #init_message ⇒ Object
-
#initialize(*args) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(*args) ⇒ Logger
Returns a new instance of Logger.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rightscale_cli/logger.rb', line 24 def initialize(*args) @log_init_msg = 'Initializing Logging using ' if ENV['RIGHT_API_CLIENT_LOG'] if File.exists?(ENV['RIGHT_API_CLIENT_LOG']) file = File.open(ENV['RIGHT_API_CLIENT_LOG'], File::WRONLY | File::APPEND) else file = ENV['RIGHT_API_CLIENT_LOG'] end @log = ::Logger.new(file) @log_init_msg += ENV['RIGHT_API_CLIENT_LOG'] else @log = ::Logger.new(STDOUT) @log_init_msg += 'STDOUT' end end |
Instance Attribute Details
#log ⇒ Object
Returns the value of attribute log.
22 23 24 |
# File 'lib/rightscale_cli/logger.rb', line 22 def log @log end |
Instance Method Details
#debug(msg) ⇒ Object
49 50 51 |
# File 'lib/rightscale_cli/logger.rb', line 49 def debug(msg) @log.debug msg end |
#error(msg) ⇒ Object
53 54 55 |
# File 'lib/rightscale_cli/logger.rb', line 53 def error(msg) @log.error msg end |
#info(msg) ⇒ Object
45 46 47 |
# File 'lib/rightscale_cli/logger.rb', line 45 def info(msg) @log.info msg end |
#init_message ⇒ Object
41 42 43 |
# File 'lib/rightscale_cli/logger.rb', line 41 def () @log.info @log_init_msg end |