heroku-request-id 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +15 -1
- data/lib/heroku-request-id/middleware.rb +2 -3
- data/lib/heroku-request-id/version.rb +1 -1
- data/spec/heroku-request-id/middleware_spec.rb +11 -11
- metadata +3 -3
data/README.md
CHANGED
@@ -18,7 +18,21 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
By default the gem will print a log line to the Heroku logs
|
22
|
+
containing the request id and the elapsed time taken processing the
|
23
|
+
request. You can disable the log line by putting this in an
|
24
|
+
initializer.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
HerokuRequestId::Middleware.log_line = false
|
28
|
+
```
|
29
|
+
|
30
|
+
You can configure the gem to add a comment to the beginning of html
|
31
|
+
requests by adding this to an initializer.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
HerokuRequestId::Middleware.html_comment = true
|
35
|
+
```
|
22
36
|
|
23
37
|
## Contributing
|
24
38
|
|
@@ -3,10 +3,9 @@ module HerokuRequestId
|
|
3
3
|
|
4
4
|
def initialize(app)
|
5
5
|
@app = app
|
6
|
-
html_comment = true
|
7
6
|
end
|
8
7
|
|
9
|
-
@@html_comment =
|
8
|
+
@@html_comment = false
|
10
9
|
|
11
10
|
def self.html_comment
|
12
11
|
@@html_comment
|
@@ -16,7 +15,7 @@ module HerokuRequestId
|
|
16
15
|
@@html_comment = hc
|
17
16
|
end
|
18
17
|
|
19
|
-
@@log_line =
|
18
|
+
@@log_line = true
|
20
19
|
|
21
20
|
def self.log_line
|
22
21
|
@@log_line
|
@@ -10,30 +10,30 @@ describe HerokuRequestId::Middleware do
|
|
10
10
|
|
11
11
|
let(:app) { HerokuRequestId::Middleware.new(inner_app) }
|
12
12
|
|
13
|
-
it "prints the request id to stdout
|
14
|
-
HerokuRequestId::Middleware.log_line = true
|
13
|
+
it "prints the request id to stdout by default" do
|
15
14
|
output = capture_stdout { get "/" }
|
16
15
|
output.should match("heroku-request-id")
|
17
|
-
# reset html_comment so that random test order works
|
18
|
-
HerokuRequestId::Middleware.log_line = false
|
19
16
|
end
|
20
17
|
|
21
|
-
it "does not print the request id to stdout
|
18
|
+
it "does not print the request id to stdout if log_line == false" do
|
19
|
+
HerokuRequestId::Middleware.log_line = false
|
22
20
|
output = capture_stdout { get "/" }
|
23
21
|
output.should_not match("heroku-request-id")
|
22
|
+
# reset html_comment so that random test order works
|
23
|
+
HerokuRequestId::Middleware.log_line = true
|
24
24
|
end
|
25
25
|
|
26
|
-
it "
|
26
|
+
it "does not add a comment with the Heroku request id by default" do
|
27
27
|
capture_stdout { get "/" }
|
28
|
-
last_response.body.
|
28
|
+
last_response.body.should_not match("Heroku request id")
|
29
29
|
end
|
30
30
|
|
31
|
-
it "does
|
32
|
-
HerokuRequestId::Middleware.html_comment =
|
31
|
+
it "does add a comment with the Heroku request id if html_comment == true" do
|
32
|
+
HerokuRequestId::Middleware.html_comment = true
|
33
33
|
capture_stdout { get "/" }
|
34
|
-
last_response.body.
|
34
|
+
last_response.body.should match("Heroku request id")
|
35
35
|
# reset html_comment so that random test order works
|
36
|
-
HerokuRequestId::Middleware.html_comment =
|
36
|
+
HerokuRequestId::Middleware.html_comment = false
|
37
37
|
end
|
38
38
|
|
39
39
|
it "makes no change to response status" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku-request-id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
segments:
|
114
114
|
- 0
|
115
|
-
hash:
|
115
|
+
hash: 1047826155926526819
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
segments:
|
123
123
|
- 0
|
124
|
-
hash:
|
124
|
+
hash: 1047826155926526819
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
127
|
rubygems_version: 1.8.24
|