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 +4 -4
- data/lib/kiev/base.rb +13 -1
- data/lib/kiev/param_filter.rb +21 -4
- data/lib/kiev/rack/request_logger.rb +0 -2
- data/lib/kiev/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 227c980f7b73aba9b41e37bba7eed1becbaab0508c4bce76cbcb1eb7a533a702
|
4
|
+
data.tar.gz: 5be6d241640e6a8d7384927be193c1a0b79dbd5bd781c16281703407464039b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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)
|
data/lib/kiev/param_filter.rb
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Kiev
|
4
|
-
|
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
|
-
|
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
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.
|
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-
|
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: []
|