Sha256: bce8f92949ee7e437e4e1eeebd87a4528ae45e5d3ded23def47b49f488f60fcb

Contents?: true

Size: 607 Bytes

Versions: 6

Compression:

Stored size: 607 Bytes

Contents

require 'logger'

module Hypertrace
  module Logging
    def log
      @_logger ||= begin
                     l = Logger.new(STDOUT)
                     l.level = get_level
                     l.progname = 'Hypertrace'
                     l
                   end
    end

    private
    def get_level
      level_map = {
        "debug" => Logger::DEBUG,
        'info' => Logger::INFO,
        'warn' => Logger::WARN,
        'error' => Logger::ERROR
      }

      level = Hypertrace::EnvVarSettings.env_value('LOG_LEVEL') || ''

      level_map.fetch(level.downcase, Logger::INFO)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hypertrace-agent-0.3.0 lib/hypertrace/logging.rb
hypertrace-agent-0.2.2 lib/hypertrace/logging.rb
hypertrace-agent-0.2.1 lib/hypertrace/logging.rb
hypertrace-agent-0.1.2 lib/hypertrace/logging.rb
hypertrace-agent-0.1.1 lib/hypertrace/logging.rb
hypertrace-agent-0.1.0 lib/hypertrace/logging.rb