httplog 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ Log outgoing HTTP requests made from your application.
10
10
 
11
11
  require 'httplog'
12
12
 
13
- Yup, that's it. By default, this will log all Net::HTTP.request calls to $stdout on DEBUG level.
13
+ Yup, that's it. By default, this will log all outgoing HTTP requests and their responses to $stdout on DEBUG level.
14
14
 
15
15
  == Configuration
16
16
 
@@ -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_response] = true
24
25
 
25
26
  So if you want to use this in a Rails app:
26
27
 
@@ -9,7 +9,8 @@ module HttpLog
9
9
  :severity => Logger::Severity::DEBUG,
10
10
  :log_connect => true,
11
11
  :log_request => true,
12
- :log_data => true
12
+ :log_data => true,
13
+ :log_response => true
13
14
  }
14
15
  end
15
16
 
@@ -40,11 +41,15 @@ module Net
40
41
  end
41
42
  end
42
43
 
43
- orig_request(req, body, &block)
44
+ response = orig_request(req, body, &block)
45
+ HttpLog::log("Response: #{response}") if HttpLog.options[:log_response]
46
+ response
44
47
  end
45
48
 
46
49
  def connect
47
- HttpLog::log("Connecting: #{@address}") if HttpLog.options[:log_connect]
50
+ unless started?
51
+ HttpLog::log("Connecting: #{@address}") if HttpLog.options[:log_connect]
52
+ end
48
53
  orig_connect
49
54
  end
50
55
  end
@@ -1,3 +1,3 @@
1
1
  module HttpLog
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,40 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: httplog
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
4
5
  prerelease:
5
- version: 0.0.5
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Thilo Rusche
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-18 00:00:00 +01:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-25 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: rspec
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70260192874620 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
24
22
  type: :development
25
23
  prerelease: false
26
- version_requirements: *id001
27
- description: |-
28
- Log outgoing HTTP requests made from your application. Helpful for tracking API calls
29
- of third party gems that don't provide their own log output.
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
36
+ description: ! "Log outgoing HTTP requests made from your application. Helpful for
37
+ tracking API calls\n of third party gems that don't provide
38
+ their own log output."
30
39
  email: thilorusche@gmail.com
31
40
  executables: []
32
-
33
41
  extensions: []
34
-
35
42
  extra_rdoc_files: []
36
-
37
- files:
43
+ files:
38
44
  - lib/httplog/http_log.rb
39
45
  - lib/httplog/version.rb
40
46
  - lib/httplog.rb
@@ -42,36 +48,31 @@ files:
42
48
  - MIT-LICENSE
43
49
  - Rakefile
44
50
  - README.rdoc
45
- has_rdoc: true
46
51
  homepage: http://github.com/trusche/httplog
47
52
  licenses: []
48
-
49
53
  post_install_message:
50
54
  rdoc_options: []
51
-
52
- require_paths:
55
+ require_paths:
53
56
  - lib
54
- required_ruby_version: !ruby/object:Gem::Requirement
57
+ required_ruby_version: !ruby/object:Gem::Requirement
55
58
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: -55724721
60
- segments:
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ segments:
61
64
  - 0
62
- version: "0"
63
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ hash: 861986528002101869
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
67
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
69
72
  requirements: []
70
-
71
73
  rubyforge_project:
72
- rubygems_version: 1.6.2
74
+ rubygems_version: 1.8.6
73
75
  signing_key:
74
76
  specification_version: 3
75
77
  summary: Logs outgoing Net::HTTP requests.
76
78
  test_files: []
77
-