Sha256: 46d9038c1e179278968d9be5c3e520b9c54fa6ff58814e2cd62061bdc6afcbf2

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

require 'log4r'

module Stove
  module Mixin::Loggable
    def self.extended(base)
      base.send(:include, InstanceMethods)
      base.send(:extend, ClassMethods)
    end

    def self.included(base)
      base.send(:include, InstanceMethods)
      base.send(:extend, ClassMethods)
    end

    module ClassMethods
      def log
        return @log if @log

        @log = Log4r::Logger.new(self.name)
        @log.outputters = Log4r::Outputter.stdout
        @log.level = 1
        @log
      end
    end

    module InstanceMethods
      def log
        self.class.log
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stove-2.0.0.beta.2 lib/stove/mixins/loggable.rb
stove-2.0.0.beta.1 lib/stove/mixins/loggable.rb