Class: RightScaleCLI::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/rightscale_cli/logger.rb

Overview

Represents a RightScale CLI Logger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rightscale_cli/logger.rb', line 25

def initialize(*)
  @log_init_msg = 'Initializing Logging using '

  if ENV['RIGHT_API_CLIENT_LOG']
    if File.exist?(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

#logObject

Returns the value of attribute log.



23
24
25
# File 'lib/rightscale_cli/logger.rb', line 23

def log
  @log
end

Instance Method Details

#debug(msg) ⇒ Object



51
52
53
# File 'lib/rightscale_cli/logger.rb', line 51

def debug(msg)
  @log.debug msg
end

#error(msg) ⇒ Object



55
56
57
# File 'lib/rightscale_cli/logger.rb', line 55

def error(msg)
  @log.error msg
end

#info(msg) ⇒ Object



47
48
49
# File 'lib/rightscale_cli/logger.rb', line 47

def info(msg)
  @log.info msg
end

#init_messageObject



43
44
45
# File 'lib/rightscale_cli/logger.rb', line 43

def init_message
  @log.info @log_init_msg
end