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.217.1 lib/instana/logger_delegator.rb
instana-1.217.0 lib/instana/logger_delegator.rb
instana-1.216.0 lib/instana/logger_delegator.rb
instana-1.215.1 lib/instana/logger_delegator.rb
instana-1.215.0 lib/instana/logger_delegator.rb
instana-1.214.4 lib/instana/logger_delegator.rb
instana-1.214.3 lib/instana/logger_delegator.rb
instana-1.214.2 lib/instana/logger_delegator.rb
instana-1.214.1 lib/instana/logger_delegator.rb
instana-1.214.0 lib/instana/logger_delegator.rb
instana-1.213.3 lib/instana/logger_delegator.rb
instana-1.213.2 lib/instana/logger_delegator.rb
instana-1.213.1 lib/instana/logger_delegator.rb
instana-1.213.0 lib/instana/logger_delegator.rb
instana-1.212.0 lib/instana/logger_delegator.rb
instana-1.211.0 lib/instana/logger_delegator.rb
instana-1.210.1 lib/instana/logger_delegator.rb
instana-1.210.0 lib/instana/logger_delegator.rb
instana-1.209.8 lib/instana/logger_delegator.rb
instana-1.209.7 lib/instana/logger_delegator.rb