rack-ougai 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/lib/rack/ougai/log_requests.rb +14 -5
- data/lib/rack/ougai/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: adb387b366736cd48de82f722cdc796dc130bad9c2f715dd538686e1af138588
|
4
|
+
data.tar.gz: b945f7a876afb625a667e322773c22340fe241da24dcc552cbdf545424e33f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b27ac0c007b2a9df35249cf6eb0de61beff16cb836a63a2ec5c872b86b2b587ad4e2a3846d4f1139135647e60590d902873e5486c44d8e5450d298e3394e7e9a
|
7
|
+
data.tar.gz: f626b4ed807cf52005d534e5563bf974d69d45b977fd0f9ea5cf9b930df1c207e3264ba58e7186a9e7009339b945afbb29c5f32a6a2da83e906daff3349064df
|
data/.gitignore
CHANGED
@@ -9,23 +9,32 @@ module Rack
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
-
|
12
|
+
start_time = Time.now
|
13
|
+
status, headers, _body = @app.call(env)
|
13
14
|
ensure
|
14
15
|
logger = @logger || env[RACK_LOGGER]
|
15
|
-
logger.info('
|
16
|
+
logger.info('http', create_log(start_time, env, status, headers))
|
16
17
|
end
|
17
18
|
|
18
19
|
private
|
19
20
|
|
20
|
-
def create_log(env, status,
|
21
|
-
|
22
|
-
|
21
|
+
def create_log(start_time, env, status, _headers)
|
22
|
+
end_time = Time.now
|
23
|
+
|
24
|
+
ret = {
|
25
|
+
time: start_time,
|
26
|
+
usec: end_time.usec - start_time.usec,
|
23
27
|
remote_addr: env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"],
|
24
28
|
method: env[REQUEST_METHOD],
|
25
29
|
path: env[PATH_INFO],
|
26
30
|
query: env[QUERY_STRING],
|
27
31
|
status: status.to_i,
|
28
32
|
}
|
33
|
+
|
34
|
+
request_id = env['HTTP_X_REQUEST_ID']
|
35
|
+
ret[:request_id] = request_id unless request_id.nil?
|
36
|
+
|
37
|
+
ret
|
29
38
|
end
|
30
39
|
|
31
40
|
end
|
data/lib/rack/ougai/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-ougai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshimitsu Takahashi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.7.3
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Rack integration for the Ougai logger.
|