Sha256: 3f688e9ced847ebb8ca4ec074d50f75c88e212762993b32ad3cc1f6325038e9d

Contents?: true

Size: 645 Bytes

Versions: 2

Compression:

Stored size: 645 Bytes

Contents

require_relative 'tlogger'

module Tlogger
  module TloggerHelper

    module TloggerClassMethods
      def tlogger(tag = nil)
        if @tlogger.nil?
          @tlogger = ::Tlogger.init
          @tlogger.tag = tag if not (tag.nil? and tag.empty?)
        end
        @tlogger
      end

      def default_logger(tag, dev_mode = false)
        ::Tlogger.set_dev_mode if dev_mode
        tlogger(tag)  
      end
    end

    def self.included(klass)
      klass.extend(TloggerClassMethods)
    end

    self.extend(TloggerClassMethods)

    if not respond_to?(:logger)
      def logger
        self.class.tlogger
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tlogger-0.26.1 lib/tlogger_helper.rb
tlogger-0.26.0 lib/tlogger_helper.rb