Module: VcenterLib::Logging

Included in:
Vcenter, VmConverter
Defined in:
lib/vcenter_lib/logging.rb

Overview

for logger access just include this module

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.loggerObject



9
10
11
12
13
14
15
# File 'lib/vcenter_lib/logging.rb', line 9

def logger
  unless @logger
    @logger = Logger.new($stdout)
    @logger.level = (ENV['LOG_LEVEL'] || Logger::INFO).to_i
  end
  @logger
end

Class Method Details

.included(base) ⇒ Object

addition



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vcenter_lib/logging.rb', line 19

def self.included(base)
  class << base
    def logger
      # :nocov:
      Logging.logger
      # :nocov:
    end

    def logger=(logger)
      # :nocov:
      Logging.logger = logger
      # :nocov:
    end
  end
end

Instance Method Details

#loggerObject



35
36
37
# File 'lib/vcenter_lib/logging.rb', line 35

def logger
  Logging.logger
end

#logger=(logger) ⇒ Object



39
40
41
# File 'lib/vcenter_lib/logging.rb', line 39

def logger=(logger)
  Logging.logger = logger
end