Class: Antrapol::ToolRack::Logger

Inherits:
Object
  • Object
show all
Includes:
ConditionUtils, Singleton
Defined in:
lib/toolrack/global.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/toolrack/global.rb', line 18

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

Instance Attribute Details

#gloggerObject (readonly)

Returns the value of attribute glogger.



17
18
19
# File 'lib/toolrack/global.rb', line 17

def glogger
  @glogger
end