api_hammer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/api_hammer/request_logger.rb +4 -2
- data/lib/api_hammer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae180a72b1ebca9d3f4806d6adb646247900aff
|
4
|
+
data.tar.gz: 658496ca213bf67761890117ec56497b534764ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c83bcc6fb8e5ab284ff7a005a1abb4daa494251cdf8be8e3c5eecf3e81823b5b059c2e615c67e0320cfa208ebec72dd5a001c826a9efe2cb5b83de43f029f71f
|
7
|
+
data.tar.gz: 75da8ae6628b64fb630c010dc88a29ff7aef5f1cd7e58c4886a8cf1b8647d4b70511b50ed42f3044f946785db79bcf48a764febed8b7c088900864d5719aa5d2
|
data/CHANGELOG.md
CHANGED
@@ -64,7 +64,6 @@ module ApiHammer
|
|
64
64
|
'Content-Type' => request.content_type,
|
65
65
|
'remote_addr' => env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"],
|
66
66
|
'User-Agent' => request.user_agent,
|
67
|
-
'body' => @request_body,
|
68
67
|
# these come from the OAuthenticator gem/middleware
|
69
68
|
'oauth.authenticated' => env['oauth.authenticated'],
|
70
69
|
'oauth.consumer_key' => env['oauth.consumer_key'],
|
@@ -77,6 +76,8 @@ module ApiHammer
|
|
77
76
|
'length' => headers['Content-Length'] || body.to_enum.map(&::Rack::Utils.method(:bytesize)).inject(0, &:+),
|
78
77
|
'Location' => response.location,
|
79
78
|
'Content-Type' => response.content_type,
|
79
|
+
# only log response body if there was an error (either client or server)
|
80
|
+
'body' => (400..599).include?(status.to_i) ? body.to_enum.to_a.join('') : nil
|
80
81
|
}.reject{|k,v| v.nil? },
|
81
82
|
'processing' => {
|
82
83
|
'began_at' => began_at.utc.to_i,
|
@@ -87,7 +88,8 @@ module ApiHammer
|
|
87
88
|
Thread.current['request_logger.info'] = nil
|
88
89
|
json_data = JSON.dump(data)
|
89
90
|
dolog = proc do
|
90
|
-
|
91
|
+
now_s = now.strftime('%Y-%m-%d %H:%M:%S %Z')
|
92
|
+
@logger.info "#{status_s} : #{bold(intense_cyan(request.request_method))} #{intense_cyan(request_uri.normalize)} @ #{intense_magenta(now_s)}"
|
91
93
|
@logger.info json_data
|
92
94
|
end
|
93
95
|
# do the logging with tags that applied to the request if appropriate
|
data/lib/api_hammer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_hammer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|