Sha256: 1555e654e148ba5b42503b735b42ac7e8f0541384eced6486143dd369344e9da

Contents?: true

Size: 644 Bytes

Versions: 57

Compression:

Stored size: 644 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  class LoggerDelegator < SimpleDelegator
    def initialize(obj)
      obj.level = level_from_environment
      super(obj)
    end

    private

    def level_from_environment
      # :nocov:
      return Logger::FATAL if ENV.key?('INSTANA_TEST') || ENV.key?('RACK_TEST')
      return Logger::DEBUG if ENV.key?('INSTANA_DEBUG')

      case ENV['INSTANA_LOG_LEVEL']
      when 'debug'
        Logger::DEBUG
      when 'warn'
        Logger::WARN
      when 'error'
        Logger::ERROR
      else
        Logger::INFO
      end
      # :nocov:
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
instana-1.202.0 lib/instana/logger_delegator.rb
instana-1.201.0 lib/instana/logger_delegator.rb
instana-1.201.0.pre1 lib/instana/logger_delegator.rb
instana-1.200.0 lib/instana/logger_delegator.rb
instana-1.200.0.pre1 lib/instana/logger_delegator.rb
instana-1.199.6 lib/instana/logger_delegator.rb
instana-1.199.5 lib/instana/logger_delegator.rb
instana-1.199.4 lib/instana/logger_delegator.rb
instana-1.199.3 lib/instana/logger_delegator.rb
instana-1.199.2 lib/instana/logger_delegator.rb
instana-1.199.1 lib/instana/logger_delegator.rb
instana-1.199.0 lib/instana/logger_delegator.rb
instana-1.198.0 lib/instana/logger_delegator.rb
instana-1.198.0.pre1 lib/instana/logger_delegator.rb
instana-1.197.0 lib/instana/logger_delegator.rb
instana-1.197.0.pre2 lib/instana/logger_delegator.rb
instana-1.197.0.pre1 lib/instana/logger_delegator.rb