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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 27e100432cac9884d52ad4933f9d3224a2256e62
4
- data.tar.gz: cea9f134706c03c91166c25dffef970ccdce29a3
2
+ SHA256:
3
+ metadata.gz: adb387b366736cd48de82f722cdc796dc130bad9c2f715dd538686e1af138588
4
+ data.tar.gz: b945f7a876afb625a667e322773c22340fe241da24dcc552cbdf545424e33f5a
5
5
  SHA512:
6
- metadata.gz: 9ee784842d6d78fb28f3d056cfbc1d38acd9b4ad4f5ce8113e977cbbfd9f640bee907850c0429eb2ffffa03dc5eebcd47203b22020e30c9036e187dd64e50ee6
7
- data.tar.gz: 73f60d0fa8de95aad6437376d9e6b7be15a4f93c71217ea525989b05baee2fc832f9d083029a0a813a7da09b10540b88c85737668c603e7d02e8f7e74d04019c
6
+ metadata.gz: b27ac0c007b2a9df35249cf6eb0de61beff16cb836a63a2ec5c872b86b2b587ad4e2a3846d4f1139135647e60590d902873e5486c44d8e5450d298e3394e7e9a
7
+ data.tar.gz: f626b4ed807cf52005d534e5563bf974d69d45b977fd0f9ea5cf9b930df1c207e3264ba58e7186a9e7009339b945afbb29c5f32a6a2da83e906daff3349064df
data/.gitignore CHANGED
@@ -7,4 +7,6 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
+ .vscode
11
+
10
12
  Gemfile.lock
@@ -9,23 +9,32 @@ module Rack
9
9
  end
10
10
 
11
11
  def call(env)
12
- status, headers, body = @app.call(env)
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('HTTP Request', create_log(env, status, headers))
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, header)
21
- {
22
- time: Time.now,
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
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Ougai
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
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.1.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: 2017-12-13 00:00:00.000000000 Z
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.6.13
114
+ rubygems_version: 2.7.3
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Rack integration for the Ougai logger.