module XasLogger
Public Class Methods
init_formatting_logger(log_dest)
click to toggle source
# File lib/xasin_logger.rb, line 6 def XasLogger.init_formatting_logger(log_dest) logger = Logger.new(log_dest); logger.formatter = proc do |severity, datetime, progname, msg| outStr = "[#{datetime.strftime("%b-%d %H:%M:%S.%L")}] #{msg}\n"; case(severity) when 'DEBUG' outStr = "D #{outStr}"; when 'WARN' outStr = "W #{outStr}".yellow when 'INFO' outStr = "I #{outStr}".green when 'ERROR' outStr = "E #{outStr}".red when 'FATAL' outStr = "F #{outStr}".black.on_red else outStr = "? #{outStr}".purple end outStr; end return logger; end
init_logger_list(list)
click to toggle source
# File lib/xasin_logger.rb, line 33 def XasLogger.init_logger_list(list) lgrList = [list].flatten; outList = Array.new(); lgrList.each do |logger| if(logger.is_a? Logger) outList << logger; else outList << init_formatting_logger(logger) end end end
loggers()
click to toggle source
# File lib/xasin_logger.rb, line 46 def XasLogger.loggers() @loggers ||= [init_formatting_logger(STDOUT)]; return @loggers end
loggers=(loggerList)
click to toggle source
# File lib/xasin_logger.rb, line 52 def XasLogger.loggers=(loggerList) @loggers = init_logger_list(loggerList); end