Sha256: 52d2f6d532dc4a9555493a9834b4cabd4583c9eaa9fc4e67639c07af7e045a35

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 Bytes

Contents

require_relative 'tlogger'

module Tlogger
  module TloggerHelper

    module ClassMethods
      def tlogger(opts = {  })
        defOpts = { tag: nil, dev_mode: false }.merge!(opts)

        if @tlogger.nil?
          @tlogger = ::Tlogger.init
          ::Tlogger.set_dev_mode if defOps[:dev_mode] == true
          @tlogger.tag = tag if not (defOpts[:tag].nil? and defOps[:tag].empty?)
        end
        @tlogger
      end

    end

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

    def tlogger
      self.class.tlogger
    end

  end
end

TloggerHelper = Tlogger::TloggerHelper

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tlogger-0.26.2 lib/tlogger_helper.rb