Class: RightScaleCLI::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#logObject

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_messageObject



41
42
43
# File 'lib/rightscale_cli/logger.rb', line 41

def init_message()
  @log.info @log_init_msg
end