kiev 4.5.0 → 4.6.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
2
  SHA256:
3
- metadata.gz: f160c0e287ac552fab279ebc1974bf2de5704af494766872e1e2abfa11b48766
4
- data.tar.gz: f2601c9be33ecc63b3741e76832b2b409250a4b5e7365ede3a40cc6a59c0eb6f
3
+ metadata.gz: 227c980f7b73aba9b41e37bba7eed1becbaab0508c4bce76cbcb1eb7a533a702
4
+ data.tar.gz: 5be6d241640e6a8d7384927be193c1a0b79dbd5bd781c16281703407464039b5
5
5
  SHA512:
6
- metadata.gz: 9560e9929db4c64e968dc39d2efadb6b9a09cff5ced0a7e5ffacd823c63273bcd05be4e1918b5e4b70586c73f8520e4d62dccc9e83795908f0981d0ed14ca6e1
7
- data.tar.gz: 4caa6b83331e522867ec3254ac5a3f0356c3336a452ade39e9c8df022f5409a17cc1a024c10cee80353252bec8da66b36aea5430cc4947c59acc0dab0fa1eccd
6
+ metadata.gz: a3760058c93f466e9ddf1e2040581dded64adf75d317265ae6e47f8ee913dd4d8b079c204ef99be2c5e1da2b40729944467a12e65f240daee9083298ae4d1015
7
+ data.tar.gz: 8c4dcdf1fcbb3b8a2c5e255a3fb3505cb4558076970b6dbb8a5e0c2ca79f59d816699fe1a8eaead9fa0445501f54d3df296aaac8f78d2ec21b40a02508899d25
data/lib/kiev/base.rb CHANGED
@@ -26,8 +26,20 @@ module Kiev
26
26
  Config.instance.logger
27
27
  end
28
28
 
29
+ def filtered_params
30
+ Config.instance.filtered_params
31
+ end
32
+
33
+ def ignored_params
34
+ Config.instance.ignored_params
35
+ end
36
+
29
37
  def event(event_name, data = EMPTY_OBJ)
30
- logger.log(::Logger::Severity::INFO, data, event_name)
38
+ logger.log(
39
+ ::Logger::Severity::INFO,
40
+ ParamFilter.filter(data, filtered_params, ignored_params),
41
+ event_name
42
+ )
31
43
  end
32
44
 
33
45
  def []=(name, value)
@@ -1,12 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kiev
4
- module ParamFilter
4
+ class ParamFilter
5
5
  FILTERED = "[FILTERED]"
6
6
 
7
7
  def self.filter(params, filtered_params, ignored_params)
8
+ new(filtered_params, ignored_params).call(params)
9
+ end
10
+
11
+ def initialize(filtered_params, ignored_params)
12
+ @filtered_params = normalize(filtered_params)
13
+ @ignored_params = normalize(ignored_params)
14
+ end
15
+
16
+ def call(params)
8
17
  params.each_with_object({}) do |(key, value), acc|
9
- next if ignored_params.include?(key)
18
+ next if ignored_params.include?(key.to_s)
10
19
 
11
20
  if defined?(ActionDispatch) && value.is_a?(ActionDispatch::Http::UploadedFile)
12
21
  value = {
@@ -17,14 +26,22 @@ module Kiev
17
26
  end
18
27
 
19
28
  acc[key] =
20
- if filtered_params.include?(key) && !value.is_a?(Hash)
29
+ if filtered_params.include?(key.to_s) && !value.is_a?(Hash)
21
30
  FILTERED
22
31
  elsif value.is_a?(Hash)
23
- filter(value, filtered_params, ignored_params)
32
+ call(value)
24
33
  else
25
34
  value
26
35
  end
27
36
  end
28
37
  end
38
+
39
+ private
40
+
41
+ attr_reader :filtered_params, :ignored_params
42
+
43
+ def normalize(params)
44
+ Set.new(params.map(&:to_s))
45
+ end
29
46
  end
30
47
  end
@@ -85,8 +85,6 @@ module Kiev
85
85
  request.params
86
86
  end
87
87
 
88
- params = ParamFilter.filter(params, config.filtered_params, config.ignored_params)
89
-
90
88
  data = {
91
89
  host: request.host, # env["HTTP_HOST"] || env["HTTPS_HOST"],
92
90
  params: params.empty? ? nil : params, # env[Rack::QUERY_STRING],
data/lib/kiev/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kiev
4
- VERSION = "4.5.0"
4
+ VERSION = "4.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiev
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blacklane
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-08 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oga
@@ -124,7 +124,7 @@ description: Kiev is a logging tool aimed at distributed environments. It logs t
124
124
  JSON, while providing human-readable output in development mode. It integrates nicely
125
125
  with Rails, Sinatra and other Rack-based frameworks, Sidekiq, Que, HTTParty, Her
126
126
  and other Faraday-based HTTP clients.
127
- email:
127
+ email:
128
128
  executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
@@ -207,7 +207,7 @@ homepage: https://github.com/blacklane/kiev
207
207
  licenses:
208
208
  - MIT
209
209
  metadata: {}
210
- post_install_message:
210
+ post_install_message:
211
211
  rdoc_options: []
212
212
  require_paths:
213
213
  - lib
@@ -222,9 +222,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubyforge_project:
225
+ rubyforge_project:
226
226
  rubygems_version: 2.7.6
227
- signing_key:
227
+ signing_key:
228
228
  specification_version: 4
229
229
  summary: Distributed logging to JSON integrated with various Ruby frameworks and tools
230
230
  test_files: []