Sha256: 18c257af99f97d31853b6ad067caa5057022426897958ed45c3e56c1ef4ba36a

Contents?: true

Size: 952 Bytes

Versions: 11

Compression:

Stored size: 952 Bytes

Contents

require 'singleton'
require_relative 'condition_utils'

require 'teLogger'
include TeLogger

require 'fileutils'

module Antrapol
  module ToolRack
 
    class Logger
      include Singleton
      include Antrapol::ToolRack::ConditionUtils

      attr_reader :glogger
      def initialize
        # boolean
        loggerDebug = ENV['TOOLRACK_DEBUG']
        logFile = ENV['TOOLRACK_LOGFILE'] || File.join(Dir.home, 'antrapol_logs','toolrack.log')
        maxLogNo = ENV['TOOLRACK_MAX_LOGFILE'] || 10
        logFileSize = ENV['TOOLRACK_MAX_LOGFILE_SIZE'] || 10*1024*1024

        logFileDir = File.dirname(logFile)
        if not File.exist?(logFileDir)
          ::FileUtils.mkdir_p(logFileDir)
        end
        
        if not_empty?(loggerDebug) and (loggerDebug.downcase == 'true')
          @glogger = Tlogger.new(STDOUT)
        else
          @glogger = Tlogger.new(logFile,maxLogNo,logFileSize)
        end
      end
    end
  
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
toolrack-0.24.3 lib/toolrack/global.rb
toolrack-0.24.2 lib/toolrack/global.rb
toolrack-0.24.1 lib/toolrack/global.rb
toolrack-0.24.0 lib/toolrack/global.rb
toolrack-0.23.3 lib/toolrack/global.rb
toolrack-0.23.2 lib/toolrack/global.rb
toolrack-0.22.1 lib/toolrack/global.rb
toolrack-0.22.0 lib/toolrack/global.rb
toolrack-0.21.0 lib/toolrack/global.rb
toolrack-0.20.2 lib/toolrack/global.rb
toolrack-0.20.1 lib/toolrack/global.rb