rack_xrk_log 0.2.5 → 0.2.8

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: 46f7acbc863218390d45ee1b5283d0de650a6bb7
4
- data.tar.gz: 2ff82d61cc08dc035f89befd0845e69756d905f7
3
+ metadata.gz: 9c360b5c124cc45a52659810e664846dd50d5454
4
+ data.tar.gz: de1b98d25971304faf1879ae0c7aef86be9bd6b5
5
5
  SHA512:
6
- metadata.gz: 8d9de54acde921e8bb97d7d420c007bc0f05a61fbe4db6169b4fc6c09311f8299ab61ad977f118196857914b9db0cd9afd415fb3ef9f8ac68162119b3796cdc1
7
- data.tar.gz: 11c7797ed44d1ea7ba39c5d27f3a021d3fb1947a57b964599389f11474dbfff0425c0a2e2c8a298b1000ec833c811402c821305c81fa5bee160f2e0265e1a7ac
6
+ metadata.gz: f559940e9bd1e9b73cf82cb19a4227a775b784d1a4dfc3c0e449210a9f2e0ffad92ccf17ee1043e2f34cc0ca753babe937115df0322ee6770f107e6c235de234
7
+ data.tar.gz: 7d63ae862aea0db06649f35ca39efdaed6cf3fce0ff14803a6c2d5b504115304a45dd67c3fb305400049c0c2078811b7d91a7249402a045d43a9c1a3db1e3c6c
@@ -3,11 +3,11 @@ module Rack
3
3
  class Base
4
4
  attr_accessor :app, :logger, :app_name, :begin_at, :log_type
5
5
 
6
- def initialize(app)
7
- app_name = @@app_name
8
- @app = app
6
+ def initialize(app, app_name)
7
+ app_name = app_name
8
+ @app = app
9
9
  @log_type = "ACCESS"
10
- @logger = ::Logger.new("log/#{app_name}_quality_access.log")
10
+ @logger = ::Logger.new("log/#{app_name}_quality_access.log")
11
11
  @logger.formatter = proc do |severity, datetime, progname, msg|
12
12
  "#{begin_at}|#{app_name}|#{log_type}|#{msg}\n"
13
13
  end
@@ -4,8 +4,8 @@ module Rack
4
4
  module XrkLog
5
5
  class Dispose < Base
6
6
 
7
- def initialize(app)
8
- @app_name = app.class.parent_name
7
+ def initialize(app, app_name)
8
+ @app_name = app_name
9
9
  super
10
10
  end
11
11
 
@@ -14,7 +14,7 @@ module Rack
14
14
 
15
15
  return if [%r{^/assets/}, %r{favicon.ico}, %r{404}].any?{|path| path.match(@request.path) }
16
16
 
17
- client_ip_and_port = "#{@request.ip}:#{@request.port}"
17
+ client_ip_and_port = "#{@request.ip}:0"
18
18
  server_ip_and_port = "#{env['SERVER_NAME']}:#{env['SERVER_PORT']}"
19
19
  query_string = @request.query_string.blank? ? "" : @request.query_string
20
20
 
@@ -39,7 +39,6 @@ module Rack
39
39
  JSON.parse(value).to_json
40
40
  end
41
41
 
42
-
43
42
  def path_parameters(env)
44
43
  opts = env["action_dispatch.request.path_parameters"]
45
44
  return "#{opts[:controller]}/#{opts[:action]}" unless opts.blank?
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.2.5'
6
+ VERSION = '0.2.8'
7
7
  end
8
8
  end
9
9
  end
@@ -5,13 +5,13 @@ module Rack
5
5
  module XrkLog
6
6
  class CommonLogger
7
7
 
8
- def initialize(app)
9
- @app = app
10
- @dispose = Dispose.new(@app)
8
+ def initialize(app, app_name)
9
+ @app = app
10
+ @dispose = Dispose.new(@app, app_name)
11
11
  end
12
12
 
13
13
  def call(env)
14
- @dispose.begin_at = DateTime.now.strftime("%Q").to_i
14
+ @dispose.begin_at = DateTime.now.strftime("%Q").to_i
15
15
  status, header, body = @app.call(env)
16
16
  @dispose.write(env, body, status, header) rescue nil
17
17
  [status, header, body]
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.2.5
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Liu