Sha256: c2de6dca27a5f1f0f8e5670d30ed9da60c1ef946feafbe24b6f52e91af93a11e

Contents?: true

Size: 621 Bytes

Versions: 3

Compression:

Stored size: 621 Bytes

Contents

require 'logatron/logatron'

class Hyperion
  module Logger

    def logger
      Logatron
    end

    def with_request_logging(route, uri, headers)
      Logatron.log(msg: "Hyperion #{route.method.to_s.upcase} #{uri}") do |logger|
        log_headers(headers, logger)
        yield
      end
    end

    def log_stub(rule)
      mr = rule.mimic_route
      logger.debug "Stubbed #{mr.method.to_s.upcase} #{mr.path}"
      log_headers(rule.headers, logger)
    end

    private

    def log_headers(headers, logger)
      headers.each_pair { |k, v| logger.info "    #{k}: #{v}" unless k == 'Expect' }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyperion_http-0.1.7 lib/hyperion/aux/logger.rb
hyperion_http-0.1.6 lib/hyperion/aux/logger.rb
hyperion_http-0.1.5 lib/hyperion/aux/logger.rb