Sha256: fe9731d85951246e91af2531fda1fadbba6e6dfc9bc5f1779e76bf87b41eca43
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true require "logger" require_relative "sniffer/version" require_relative "sniffer/config" require_relative "sniffer/data_item" require_relative "sniffer/data" # Sniffer allows to log http requests module Sniffer class << self def config @config ||= Config.new yield @config if block_given? @config end def enable! Thread.current[:sniffer] = true end def disable! Thread.current[:sniffer] = false end def enabled? Thread.current[:sniffer] = config.enabled if Thread.current[:sniffer].nil? !!Thread.current[:sniffer] end def configure yield(config) if block_given? end def clear! data.clear end def reset! @config = Config.new Thread.current[:sniffer] = config.enabled clear! end def data @data ||= Sniffer::Data.new end def store(data_item) data.store(data_item) end def logger config.logger end end end require_relative "sniffer/adapters/net_http_adapter" require_relative "sniffer/adapters/httpclient_adapter" require_relative "sniffer/adapters/http_adapter" require_relative "sniffer/adapters/patron_adapter" require_relative "sniffer/adapters/curb_adapter" require_relative "sniffer/adapters/ethon_adapter" require_relative "sniffer/adapters/eventmachine_adapter" require_relative "sniffer/adapters/excon_adapter"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sniffer-0.2.0 | lib/sniffer.rb |