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.209.6 lib/instana/logger_delegator.rb
instana-1.209.5 lib/instana/logger_delegator.rb
instana-1.209.4 lib/instana/logger_delegator.rb
instana-1.209.3 lib/instana/logger_delegator.rb
instana-1.209.2 lib/instana/logger_delegator.rb
instana-1.209.1 lib/instana/logger_delegator.rb
instana-1.209.0.pre3 lib/instana/logger_delegator.rb
instana-1.209.0.pre2 lib/instana/logger_delegator.rb
instana-1.209.0.pre1 lib/instana/logger_delegator.rb
instana-1.208.0 lib/instana/logger_delegator.rb
instana-1.207.0 lib/instana/logger_delegator.rb
instana-1.206.0 lib/instana/logger_delegator.rb
instana-1.205.0 lib/instana/logger_delegator.rb
instana-1.204.0 lib/instana/logger_delegator.rb
instana-1.204.0.pre3 lib/instana/logger_delegator.rb
instana-1.204.0.pre2 lib/instana/logger_delegator.rb
instana-1.204.0.pre1 lib/instana/logger_delegator.rb
instana-1.203.2 lib/instana/logger_delegator.rb
instana-1.203.1 lib/instana/logger_delegator.rb
instana-1.203.0 lib/instana/logger_delegator.rb