httplog 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -16,13 +16,14 @@ Yup, that's it. By default, this will log all outgoing HTTP requests and their r
16
16
 
17
17
  You can override the following default options:
18
18
 
19
- HttpLog.options[:logger] = Logger.new($stdout)
20
- HttpLog.options[:severity] = Logger::Severity::DEBUG
21
- HttpLog.options[:log_connect] = true
22
- HttpLog.options[:log_request] = true
23
- HttpLog.options[:log_data] = true
24
- HttpLog.options[:log_status] = true
25
- HttpLog.options[:log_response] = true
19
+ HttpLog.options[:logger] = Logger.new($stdout)
20
+ HttpLog.options[:severity] = Logger::Severity::DEBUG
21
+ HttpLog.options[:log_connect] = true
22
+ HttpLog.options[:log_request] = true
23
+ HttpLog.options[:log_data] = true
24
+ HttpLog.options[:log_status] = true
25
+ HttpLog.options[:log_response] = true
26
+ HttpLog.options[:log_benchmark] = true
26
27
 
27
28
  So if you want to use this in a Rails app:
28
29
 
@@ -5,13 +5,14 @@ module HttpLog
5
5
 
6
6
  def self.options
7
7
  @@options ||= {
8
- :logger => Logger.new($stdout),
9
- :severity => Logger::Severity::DEBUG,
10
- :log_connect => true,
11
- :log_request => true,
12
- :log_data => true,
13
- :log_status => true,
14
- :log_response => true
8
+ :logger => Logger.new($stdout),
9
+ :severity => Logger::Severity::DEBUG,
10
+ :log_connect => true,
11
+ :log_request => true,
12
+ :log_data => true,
13
+ :log_status => true,
14
+ :log_response => true,
15
+ :log_benchmark => true
15
16
  }
16
17
  end
17
18
 
@@ -42,9 +43,12 @@ module Net
42
43
  end
43
44
  end
44
45
 
46
+ r0 = Time.now
45
47
  response = orig_request(req, body, &block)
46
48
 
49
+ benchmark = Time.now - r0
47
50
  if started?
51
+ HttpLog::log("[httplog] Benchmark: #{benchmark}") if HttpLog.options[:log_benchmark]
48
52
  HttpLog::log("[httplog] Status: #{response.code}") if HttpLog.options[:log_status]
49
53
  HttpLog::log("[httplog] Response: #{response.body}") if HttpLog.options[:log_response]
50
54
  end
@@ -1,3 +1,3 @@
1
1
  module HttpLog
2
- VERSION = "0.0.7"
3
- end
2
+ VERSION = "0.0.8"
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.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-25 00:00:00.000000000Z
12
+ date: 2012-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70321651764120 !ruby/object:Gem::Requirement
16
+ requirement: &70260787628680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70321651764120
24
+ version_requirements: *70260787628680
25
25
  description: ! "Log outgoing HTTP requests made from your application. Helpful for
26
26
  tracking API calls\n of third party gems that don't provide
27
27
  their own log output."
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  segments:
53
53
  - 0
54
- hash: 3231877750156907243
54
+ hash: 3192399211165179512
55
55
  required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 1.8.6
63
+ rubygems_version: 1.8.10
64
64
  signing_key:
65
65
  specification_version: 3
66
66
  summary: Logs outgoing Net::HTTP requests.