module Util
Public Class Methods
getJSONArgs()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/Util.rb, line 64 def Util.getJSONArgs() jsonin = nil loop { case ARGV[0] when '-jsoninput' then ARGV.shift; jsonin = ARGV.shift when /^-/ then usage("Unknown option: #{ARGV[0].inspect}") else break end; } return JSON.load(jsonin); end
log(logger, level, logString)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/Util.rb, line 16 def Util.log(logger, level, logString) case level when "debug" logger.debug(logString) when "fatal" logger.fatal(logString) when "error" logger.error(logString) when "warn" logger.warn(logString) when "info" logger.info(logString) else logger.unknown(logString) end end
logClose(logger)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/Util.rb, line 60 def Util.logClose(logger) logger.close end
logInit()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/Util.rb, line 8 def Util.logInit() logger = Logger.new(STDOUT) logger.formatter = proc do |severity, datetime, progname, msg| "#{severity}: #{msg}\n" end return logger end
logIt(logger, log_level, log_level_string, messageString)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/Util.rb, line 33 def Util.logIt(logger, log_level, log_level_string, messageString) case log_level.downcase when "debug" if "debug".eql? log_level_string or "fatal".eql? log_level_string or "error".eql? log_level_string or "warn".eql? log_level_string or "info".eql? log_level_string log(logger, "debug", messageString) end when "fatal" if "fatal".eql? log_level_string log(logger, "fatal", messageString) end when "error" if "error".eql? log_level_string log(logger, "error", messageString) end when "warn" if "warn".eql? log_level_string log(logger, "warn", messageString) end when "info" if "info".eql? log_level_string log(logger, "info", messageString) end else log(logger, "unknown", messageString) end end
openJSONFile(fileNameWithPath)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/Util.rb, line 74 def Util.openJSONFile(fileNameWithPath) begin config = JSON.load(File.open(fileNameWithPath)) return config rescue return false end end