Module: Dcmgr::Logger

Class Method Summary collapse

Class Method Details

.create(name = nil) ⇒ Object

Factory method for ::Logger



18
19
20
21
22
# File 'lib/dcmgr/logger.rb', line 18

def self.create(name=nil)
  l = ::Logger.new(default_logdev)
  l.progname = name
  l
end

.default_logdevObject



13
14
15
# File 'lib/dcmgr/logger.rb', line 13

def self.default_logdev
  @logdev
end

.included(klass) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/dcmgr/logger.rb', line 24

def self.included(klass)
  klass.class_eval {

    @class_logger = Logger.create(self.to_s.split('::').last)

    def self.logger
      @class_logger
    end

    def logger
      self.class.logger
    end

    def self.logger_name
      @class_logger.progname
    end

    def self.logger_name=(name)
      @class_logger.progname = name
    end
  }
end