rack_xrk_log 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 553c859785a8fa45fa05f90efdef0e8a4369b1fb
4
- data.tar.gz: e1b4db48fe49b73a8ef00e094cdfc16ab455d088
3
+ metadata.gz: 33d4546baca10d3c03bc035715448b12819291b3
4
+ data.tar.gz: 5ebfbb9b60beabbcd59980b1aecd25ec1bf0b1d4
5
5
  SHA512:
6
- metadata.gz: 865c341d72ab402508b81ef044bd4129f0bf1b4ed46efcaaedfda803be2c46548d4d68dcb519fb9af6bc133e1b5f5983caadf2de21ce09e89883d5469b395c73
7
- data.tar.gz: 7c254f114f9bb1f48c71d4c60e468a8d04e4a95ee50825dc1ce93cf206bdd099de7a5bd8ebf4ae43ac8187837e1a78a10e8b17760de5a6516203eb92a53438a6
6
+ metadata.gz: cb85a59edf3a54aeebc9439518da8a58049c350c13401ef3b0c6202d053708d5d4f0bf0f4a345101c082f413513f1c7a70c8895ae1c2836a461ff0e674479bd8
7
+ data.tar.gz: 6205353f7e245075db6a67efdd2fbaa7c627ce256f9915033508971ac0e0089dc27d67d19bb9ffbd3fcc08c1320aa5627f7116564cc93ad28ee6d82bead8e245
@@ -2,10 +2,10 @@ module Rack
2
2
  module XrkLog
3
3
  class Base
4
4
  attr_accessor :app, :logger, :app_name, :begin_at, :log_type
5
-
5
+
6
6
  def initialize(app)
7
7
  @app = app
8
- @log_type = "ACESS"
8
+ @log_type = "ACCESS"
9
9
  @logger = ::Logger.new("log/#{app.class.parent_name.downcase}_quality_access.log")
10
10
  @logger.formatter = proc do |severity, datetime, progname, msg|
11
11
  "#{begin_at}|#{app_name}|#{log_type}|#{msg}\n"
@@ -28,7 +28,7 @@ module Rack
28
28
  body = formatter(env, body, status, header)
29
29
  @logger.info(body) unless body.nil?
30
30
  end
31
-
31
+
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -14,10 +14,13 @@ module Rack
14
14
 
15
15
  return if [%r{^/assets/}, %r{favicon.ico}].any?{|path| path.match(@request.path) }
16
16
 
17
- query_string = @request.query_string.blank? ? "-" : @request.query_string
17
+ client_ip_and_port = "#{@request.host}:#{@request.port}"
18
+ server_ip_and_port = "#{env['SERVER_NAME']}:#{env['SERVER_PORT']}"
19
+ query_string = @request.query_string.blank? ? "-" : @request.query_string
20
+
18
21
  [
19
- @request.ip,
20
- @request.host_with_port,
22
+ client_ip_and_port,
23
+ server_ip_and_port,
21
24
  total_runtime,
22
25
  @request.scheme,
23
26
  @request.content_length || 0,
@@ -27,10 +30,12 @@ module Rack
27
30
  status,
28
31
  query_string,
29
32
  path_parameters(env),
33
+ "-",
30
34
  json_with_nil(body[0]) || "-"
31
35
  ].join("|")
32
36
  end
33
37
 
38
+
34
39
  def json_with_nil(value)
35
40
  JSON.parse(value) rescue nil
36
41
  end
data/lib/rack/xrk/log.rb CHANGED
@@ -3,7 +3,7 @@ require 'rack/xrk/log/commonlogger'
3
3
  module Rack
4
4
  module Xrk
5
5
  module Log
6
- VERSION = '0.1.6'
6
+ VERSION = '0.1.7'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack_xrk_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Liu