module SgtnClient

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Copyright 2022 VMware, Inc. SPDX-License-Identifier: EPL-2.0

Constants

LOGFILE_SHIFT_AGE
MAP_LOCALES
SUPPORTED_LOCALES

Public Class Methods

configure(options = {}, &block) click to toggle source
# File lib/sgtn-client/sgtn-client.rb, line 27
def configure(options = {}, &block)
SgtnClient::Config.configure(options, &block)
end
load(*args) click to toggle source
# File lib/sgtn-client/sgtn-client.rb, line 32
def load(*args)
      # load configuration file
      begin
        SgtnClient::Config.load(args[0], args[1])
        SgtnClient::ValidateUtil.validate_config()
      rescue => exception
        file = File.open('./error.log', 'a')
        file.sync = true
        log = Logger.new(file)
        log.error exception.message
      end

      # create log file
      file = './sgtnclient_d.log'
      SgtnClient.logger.debug "[Client][load]create log file=#{file}"
      if args[2] != nil
            file = args[2]
      end
      file = File.open(file, 'a')
      file.sync = true
      SgtnClient.logger = Logger.new(file, LOGFILE_SHIFT_AGE)

      # Set log level for sandbox mode
      env = SgtnClient::Config.default_environment
      mode = SgtnClient::Config.configurations[env]["mode"]
      SgtnClient.logger.debug "[Client][load]set log level, mode=#{mode}"
      if mode == 'sandbox'
            SgtnClient.logger.level = Logger::DEBUG
      else 
            SgtnClient.logger.level = Logger::INFO
      end

      # initialize cache
      disable_cache = SgtnClient::Config.configurations[env]["disable_cache"]
      SgtnClient.logger.debug "[Client][load]cache initialize, disable_cache=#{disable_cache}"
      if disable_cache != nil
            SgtnClient::Core::Cache.initialize(disable_cache)
      else
            SgtnClient::Core::Cache.initialize()
      end
end
logger() click to toggle source
# File lib/sgtn-client/sgtn-client.rb, line 74
def logger
      SgtnClient::Config.logger
end
logger=(log) click to toggle source
# File lib/sgtn-client/sgtn-client.rb, line 78
def logger=(log)
      SgtnClient::Config.logger = log
end