httplog 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,6 +10,7 @@ So far this gem works with the following ruby modules and libraries:
10
10
  * [Ethon](https://github.com/typhoeus/ethon)
11
11
  * [Excon](https://github.com/geemus/excon)
12
12
  * [OpenURI](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/index.html)
13
+ * [Patron](https://github.com/toland/patron)
13
14
  * [HTTPClient](https://github.com/nahi/httpclient)
14
15
  * [HTTParty](https://github.com/jnunemaker/httparty)
15
16
 
@@ -98,7 +99,7 @@ With the default configuration, the log output might look like this:
98
99
  D, [2012-11-22T18:39:46.033409 #12800] DEBUG -- : [httplog] Status: 200
99
100
  D, [2012-11-22T18:39:46.033483 #12800] DEBUG -- : [httplog] Benchmark: 0.001562 seconds
100
101
 
101
- * When using Ethon and any library based on it (such as Typhoeus),
102
+ * When using Ethon or Patron, and any library based on them (such as Typhoeus),
102
103
  the TCP connection is not logged (since it's established by libcurl).
103
104
 
104
105
  ### Running the specs
@@ -119,6 +120,7 @@ Please include passing specs with all pull requests.
119
120
 
120
121
  Thanks to these fine folks for contributing pull requests:
121
122
 
123
+ * [Doug Johnston](https://github.com/dougjohnston)
122
124
  * [Eric Cohen](https://github.com/eirc)
123
125
  * [Nikos Dimitrakopoulos](https://github.com/nikosd)
124
126
  * [Marcos Hack](https://github.com/marcoshack)
data/lib/httplog.rb CHANGED
@@ -4,3 +4,4 @@ require "httplog/adapters/net_http"
4
4
  require "httplog/adapters/httpclient"
5
5
  require "httplog/adapters/excon"
6
6
  require "httplog/adapters/ethon"
7
+ require "httplog/adapters/patron"
@@ -0,0 +1,21 @@
1
+ if defined?(Patron)
2
+ module Patron
3
+ class Session
4
+ alias_method :orig_request, :request
5
+ def request(action_name, url, headers, options = {})
6
+ HttpLog.log_request(action_name, url)
7
+ HttpLog.log_headers(headers)
8
+ HttpLog.log_data(options[:data]) if action_name == :post
9
+
10
+ bm = Benchmark.realtime do
11
+ @response = orig_request(action_name, url, headers, options)
12
+ end
13
+
14
+ HttpLog.log_compact(action_name, url, @response.status, bm)
15
+ HttpLog.log_status(@response.status)
16
+ HttpLog.log_benchmark(bm)
17
+ HttpLog.log_body(@response.body)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,4 +1,4 @@
1
1
  module HttpLog
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httplog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-29 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -155,6 +155,22 @@ dependencies:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: patron
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
158
174
  description: ! "Log outgoing HTTP requests made from your application. Helpful for
159
175
  tracking API calls\n of third party gems that don't provide
160
176
  their own log output."
@@ -167,6 +183,7 @@ files:
167
183
  - lib/httplog/adapters/excon.rb
168
184
  - lib/httplog/adapters/httpclient.rb
169
185
  - lib/httplog/adapters/net_http.rb
186
+ - lib/httplog/adapters/patron.rb
170
187
  - lib/httplog/http_log.rb
171
188
  - lib/httplog/version.rb
172
189
  - lib/httplog.rb
@@ -185,12 +202,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
202
  - - ! '>='
186
203
  - !ruby/object:Gem::Version
187
204
  version: '0'
205
+ segments:
206
+ - 0
207
+ hash: 1928624489278995380
188
208
  required_rubygems_version: !ruby/object:Gem::Requirement
189
209
  none: false
190
210
  requirements:
191
211
  - - ! '>='
192
212
  - !ruby/object:Gem::Version
193
213
  version: '0'
214
+ segments:
215
+ - 0
216
+ hash: 1928624489278995380
194
217
  requirements: []
195
218
  rubyforge_project:
196
219
  rubygems_version: 1.8.24
@@ -198,4 +221,3 @@ signing_key:
198
221
  specification_version: 3
199
222
  summary: Logs outgoing HTTP requests.
200
223
  test_files: []
201
- has_rdoc: