httplog 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -21,6 +21,7 @@ You can override the following default options:
21
21
  HttpLog.options[:log_connect] = true
22
22
  HttpLog.options[:log_request] = true
23
23
  HttpLog.options[:log_data] = true
24
+ HttpLog.options[:log_status] = true
24
25
  HttpLog.options[:log_response] = true
25
26
 
26
27
  So if you want to use this in a Rails app:
@@ -10,6 +10,7 @@ module HttpLog
10
10
  :log_connect => true,
11
11
  :log_request => true,
12
12
  :log_data => true,
13
+ :log_status => true,
13
14
  :log_response => true
14
15
  }
15
16
  end
@@ -30,25 +31,30 @@ module Net
30
31
 
31
32
  if started?
32
33
  if HttpLog.options[:log_request]
33
- HttpLog::log("Sending: #{req.method} http://#{@address}:#{@port}#{req.path}")
34
+ HttpLog::log("[httplog] Sending: #{req.method} http://#{@address}:#{@port}#{req.path}")
34
35
  end
35
36
 
36
37
  if req.method == "POST" && HttpLog.options[:log_data]
37
38
  # a bit convoluted becase post_form uses form_data= to assign the data, so
38
39
  # in that case req.body will be empty
39
40
  data = req.body.nil? || req.body.size == 0 ? body : req.body
40
- HttpLog::log("Data: #{data}")
41
+ HttpLog::log("[httplog] Data: #{data}")
41
42
  end
42
43
  end
43
44
 
44
45
  response = orig_request(req, body, &block)
45
- HttpLog::log("Response: #{response}") if HttpLog.options[:log_response]
46
+
47
+ if started?
48
+ HttpLog::log("[httplog] Status: #{response.code}") if HttpLog.options[:log_status]
49
+ HttpLog::log("[httplog] Response: #{response.body}") if HttpLog.options[:log_response]
50
+ end
51
+
46
52
  response
47
53
  end
48
54
 
49
55
  def connect
50
56
  unless started?
51
- HttpLog::log("Connecting: #{@address}") if HttpLog.options[:log_connect]
57
+ HttpLog::log("[httplog] Connecting: #{@address}") if HttpLog.options[:log_connect]
52
58
  end
53
59
  orig_connect
54
60
  end
@@ -1,3 +1,3 @@
1
1
  module HttpLog
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70260192874620 !ruby/object:Gem::Requirement
16
+ requirement: &70321651764120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,18 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70260192874620
25
- - !ruby/object:Gem::Dependency
26
- name: fakeweb
27
- requirement: &70260192874200 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *70260192874200
24
+ version_requirements: *70321651764120
36
25
  description: ! "Log outgoing HTTP requests made from your application. Helpful for
37
26
  tracking API calls\n of third party gems that don't provide
38
27
  their own log output."
@@ -62,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
62
51
  version: '0'
63
52
  segments:
64
53
  - 0
65
- hash: 861986528002101869
54
+ hash: 3231877750156907243
66
55
  required_rubygems_version: !ruby/object:Gem::Requirement
67
56
  none: false
68
57
  requirements: