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 +8 -7
- data/lib/httplog/http_log.rb +11 -7
- data/lib/httplog/version.rb +2 -2
- metadata +6 -6
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]
|
20
|
-
HttpLog.options[:severity]
|
21
|
-
HttpLog.options[:log_connect]
|
22
|
-
HttpLog.options[:log_request]
|
23
|
-
HttpLog.options[:log_data]
|
24
|
-
HttpLog.options[:log_status]
|
25
|
-
HttpLog.options[:log_response]
|
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
|
|
data/lib/httplog/http_log.rb
CHANGED
@@ -5,13 +5,14 @@ module HttpLog
|
|
5
5
|
|
6
6
|
def self.options
|
7
7
|
@@options ||= {
|
8
|
-
:logger
|
9
|
-
:severity
|
10
|
-
:log_connect
|
11
|
-
:log_request
|
12
|
-
:log_data
|
13
|
-
:log_status
|
14
|
-
:log_response
|
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
|
data/lib/httplog/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module HttpLog
|
2
|
-
VERSION = "0.0.
|
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.
|
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:
|
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: &
|
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: *
|
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:
|
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.
|
63
|
+
rubygems_version: 1.8.10
|
64
64
|
signing_key:
|
65
65
|
specification_version: 3
|
66
66
|
summary: Logs outgoing Net::HTTP requests.
|