Sha256: 2fbad5e61a2d39eb489d5e44df00f62419cfe408ad9cf2088328a7c46140f4d9

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

require "logger"
require_relative "constants"

module Lambdatest
  module Sdk
    module Utils        
      def self.log_level
        if ENV['LT_SDK_DEBUG'] == 'true'
          Logger::DEBUG
        else
          log_level_str = ENV.fetch('LT_SDK_LOG_LEVEL', 'info').downcase
          case log_level_str
          when 'debug'
            Logger::DEBUG
          when 'warning'
            Logger::WARN
          when 'error'
            Logger::ERROR
          when 'critical'
            Logger::FATAL
          else
            Logger::INFO
          end
        end
      end
        
      def self.get_logger(pkgName)
        logger = Logger.new(STDOUT)
        logger.level = log_level
        logger.progname = pkgName
        logger
      end
    end
  end
end
  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lambdatest-sdk-utils-1.0.2 lib/lambdatest/sdk/utils/logger.rb