kiev 4.6.0 → 4.7.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: 227c980f7b73aba9b41e37bba7eed1becbaab0508c4bce76cbcb1eb7a533a702
4
- data.tar.gz: 5be6d241640e6a8d7384927be193c1a0b79dbd5bd781c16281703407464039b5
3
+ metadata.gz: 5da27510343d0217fedb4e4282cf9fc6468a63be4484935e2495e31205a2b188
4
+ data.tar.gz: 3a7ac16381946c418fa4265ab440da10397514766e5c091a87847f4451644251
5
5
  SHA512:
6
- metadata.gz: a3760058c93f466e9ddf1e2040581dded64adf75d317265ae6e47f8ee913dd4d8b079c204ef99be2c5e1da2b40729944467a12e65f240daee9083298ae4d1015
7
- data.tar.gz: 8c4dcdf1fcbb3b8a2c5e255a3fb3505cb4558076970b6dbb8a5e0c2ca79f59d816699fe1a8eaead9fa0445501f54d3df296aaac8f78d2ec21b40a02508899d25
6
+ metadata.gz: ee5e47a70aae2576a0d119c0347fa9707f8a1ff53e8db3f5c1b8ae0bcc39907fd755f1d6112eca317e3b22ce8e2bdb59e83f3e9b70b86014fae995a4377da466
7
+ data.tar.gz: d976cb714c3e9ca5a2f3aa9c0a505a78d38d4a1c77faddc408555dec2ff3f337dbc9430d881630165933084e2a5c88051ef6fbe530a2c79ebf2f24b64949a329
data/lib/kiev/base.rb CHANGED
@@ -34,11 +34,11 @@ module Kiev
34
34
  Config.instance.ignored_params
35
35
  end
36
36
 
37
- def event(event_name, data = EMPTY_OBJ)
37
+ def event(log_name, data = EMPTY_OBJ)
38
38
  logger.log(
39
39
  ::Logger::Severity::INFO,
40
40
  ParamFilter.filter(data, filtered_params, ignored_params),
41
- event_name
41
+ log_name
42
42
  )
43
43
  end
44
44
 
data/lib/kiev/logger.rb CHANGED
@@ -12,17 +12,19 @@ module Kiev
12
12
  extend Forwardable
13
13
  def_delegators(*([:@logger] + ::Logger.instance_methods(false)))
14
14
 
15
- DEFAULT_EVENT_NAME = "log"
15
+ DEFAULT_LOG_NAME = "log"
16
+ DEFAULT_MESSAGE = "log"
16
17
  LOG_ERROR = "ERROR"
17
18
  ERROR_STATUS = 500
18
19
 
19
- FORMATTER = proc do |severity, time, event_name, data|
20
+ FORMATTER = proc do |severity, time, log_name, data|
20
21
  entry =
21
22
  {
22
23
  application: Config.instance.app,
23
- event: event_name || DEFAULT_EVENT_NAME,
24
+ log_name: log_name || DEFAULT_LOG_NAME,
24
25
  level: severity,
25
26
  timestamp: time.utc,
27
+ message: log_name || DEFAULT_MESSAGE,
26
28
  tracking_id: RequestStore.store[:tracking_id],
27
29
  request_id: RequestStore.store[:request_id],
28
30
  request_depth: RequestStore.store[:request_depth],
@@ -39,12 +41,12 @@ module Kiev
39
41
  entry[:jid] = RequestStore.store[:jid]
40
42
  end
41
43
 
42
- if !RequestStore.store[:subrequest_count] && %i(request_finished job_finished).include?(event_name)
44
+ if !RequestStore.store[:subrequest_count] && %i(request_finished job_finished).include?(log_name)
43
45
  entry[:tree_leaf] = true
44
46
  end
45
47
 
46
48
  if RequestStore.store[:payload]
47
- if %i(request_finished job_finished).include?(event_name)
49
+ if %i(request_finished job_finished).include?(log_name)
48
50
  entry.merge!(RequestStore.store[:payload])
49
51
  else
50
52
  Config.instance.persistent_log_fields.each do |field|
@@ -68,17 +70,17 @@ module Kiev
68
70
  JSON.logstash(entry)
69
71
  end
70
72
 
71
- DEVELOPMENT_FORMATTER = proc do |severity, time, event_name, data|
73
+ DEVELOPMENT_FORMATTER = proc do |severity, time, log_name, data|
72
74
  entry = []
73
75
 
74
76
  entry << time.iso8601
75
- entry << (event_name || severity).upcase
77
+ entry << (log_name || severity).upcase
76
78
 
77
79
  if data.is_a?(String)
78
80
  entry << "#{data}\n"
79
81
  end
80
82
 
81
- if %i(request_finished job_finished).include?(event_name)
83
+ if %i(request_finished job_finished).include?(log_name)
82
84
  verb = RequestStore.store[:request_verb]
83
85
  path = RequestStore.store[:request_path]
84
86
  entry << "#{verb} #{path}" if verb && path
@@ -14,6 +14,8 @@ module Kiev
14
14
  end
15
15
 
16
16
  def call(params)
17
+ return params unless filterable?(params)
18
+
17
19
  params.each_with_object({}) do |(key, value), acc|
18
20
  next if ignored_params.include?(key.to_s)
19
21
 
@@ -40,6 +42,10 @@ module Kiev
40
42
 
41
43
  attr_reader :filtered_params, :ignored_params
42
44
 
45
+ def filterable?(params)
46
+ params.respond_to?(:each_with_object)
47
+ end
48
+
43
49
  def normalize(params)
44
50
  Set.new(params.map(&:to_s))
45
51
  end
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.6.0"
4
+ VERSION = "4.7.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.6.0
4
+ version: 4.7.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-06-23 00:00:00.000000000 Z
11
+ date: 2021-10-20 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: []