Sha256: 12529103ebf4e0a03ab6903cfddd979cc8e008d0c21a858d655deb4e3e32e79d

Contents?: true

Size: 755 Bytes

Versions: 4

Compression:

Stored size: 755 Bytes

Contents

# -*- coding: utf-8 -*-
require 'logger'

module Dcmgr
  module Logger

    @logdev = ::Logger::LogDevice.new(STDOUT)

    def self.default_logdev
      @logdev
    end

    # Factory method for ::Logger
    def self.create(name=nil)
      l = ::Logger.new(default_logdev)
      l.progname = name
      l
    end
    
    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
    
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
wakame-vdc-dcmgr-10.12.0 lib/dcmgr/logger.rb
wakame-vdc-agents-10.12.0 lib/dcmgr/logger.rb
wakame-vdc-dcmgr-10.11.0 lib/dcmgr/logger.rb
wakame-vdc-agents-10.11.0 lib/dcmgr/logger.rb