Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Log outgoing HTTP requests

tag: 0.0.9

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rdoc

httplog

Log outgoing HTTP requests made from your application.

Installation

gem install httplog

Usage

require 'httplog'

Yup, that's it. By default, this will log all outgoing HTTP requests and their responses to $stdout on DEBUG level.

Configuration

You can override the following default options:

HttpLog.options[:logger]        = Logger.new($stdout)
HttpLog.options[:severity]      = Logger::Severity::DEBUG
HttpLog.options[:log_connect]   = true
HttpLog.options[:log_request]   = true
HttpLog.options[:log_data]      = true
HttpLog.options[:log_status]    = true
HttpLog.options[:log_response]  = true
HttpLog.options[:log_benchmark] = true
HttpLog.options[:compact_log]   = false # setting this to true will make all "log_*" options redundant

So if you want to use this in a Rails app:

# file: config/initializers/httplog.rb

HttpLog.options[:logger] = Rails.logger

Development

To run the tests, a web server must be listening on localhost port 3000. Then simply run `bundle exec rake`. The tests will make GET and POST requests to `localhost:3000/foo` by default.

TODO: Make tests self-contained.

Something went wrong with that request. Please try again.