kiev 4.2.0 → 4.3.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: 73f0c5559061955f9b4c280dede2c9058dafc945c9135da19fdc95a39472e6a2
4
- data.tar.gz: 9e309d5c459846f1e8d44411e24aa6dbdb7b214cc88241af433258ce95e1e7ea
3
+ metadata.gz: 077b62ba98a1a883bb9cf7596983156864e1011bdb189ee80cc1d0e8e4039c08
4
+ data.tar.gz: beb8bdd2f1d31501d5ef4d501d221c1fabe522b9a106e4f7bb150e46aa168029
5
5
  SHA512:
6
- metadata.gz: a0e848be9fbec89daa97f5b20fb951a8725152739c9bdae7207f6bfc8576ae5e983ba2c310382f7bf0a143d6a2409cd8f6d868f109e0ea68ad43b860979b9683
7
- data.tar.gz: 82597ec57a2f30c69c53ff4a54d55fc30fb7511b49ecd0da5b54d0896682f6ad4789bdf380fbb41c80b21a9351515c16265c56c141ce55e9fa2711f957303719
6
+ metadata.gz: bb2ff70083d47ac226628cb796f34f607454c6db6b458a63cca06fdbf014a75f28d02ddc29a7b9caf8e4c309148b0adfbfc0a4cdbafcf1030d4e7996a65cf4f5
7
+ data.tar.gz: 3fb4a342b5d0b475da14cd99f553ee3b5ee02a1f299f11e2d1afb0ab11353672a14373850b657ca9cc755d6d4474439d32d95b09bc94177c749f9b04eda71a3e
@@ -13,6 +13,8 @@ module Kiev
13
13
  def_delegators(*([:@logger] + ::Logger.instance_methods(false)))
14
14
 
15
15
  DEFAULT_EVENT_NAME = "log"
16
+ LOG_ERROR = "ERROR"
17
+ ERROR_STATUS = 500
16
18
 
17
19
  FORMATTER = proc do |severity, time, event_name, data|
18
20
  entry =
@@ -54,8 +56,11 @@ module Kiev
54
56
  entry.merge!(data)
55
57
  elsif !data.nil?
56
58
  entry[:message] = data.to_s
59
+ entry[:status] = ERROR_STATUS if data.to_s.downcase.include?(LOG_ERROR)
57
60
  end
58
61
 
62
+ entry[:level] = LOG_ERROR if entry[:status].to_i.between?(400, 599)
63
+
59
64
  # Save some disk space
60
65
  entry.reject! { |_, value| value.nil? }
61
66
 
@@ -27,6 +27,7 @@ module Kiev
27
27
  private
28
28
 
29
29
  NEW_LINE = "\n"
30
+ LOG_ERROR = "ERROR"
30
31
 
31
32
  def kiev_run
32
33
  args = attrs[:args]
@@ -69,6 +70,7 @@ module Kiev
69
70
  data[:error_class] = error.class.name
70
71
  data[:error_message] = error.message[0..5000]
71
72
  data[:error_backtrace] = Array(error.backtrace).join(NEW_LINE)[0..5000]
73
+ data[:level] = LOG_ERROR
72
74
  end
73
75
 
74
76
  Kiev.event(:job_finished, data)
@@ -8,6 +8,7 @@ module Kiev
8
8
  ERROR_STATUS = 500
9
9
  ERROR_HEADERS = [].freeze
10
10
  ERROR_BODY = [""].freeze
11
+ LOG_ERROR = "ERROR"
11
12
 
12
13
  def initialize(app)
13
14
  @app = app
@@ -96,6 +97,8 @@ module Kiev
96
97
  route: extract_route(env)
97
98
  }
98
99
 
100
+ data[:level] = LOG_ERROR if data[:status].to_i.between?(400, 599)
101
+
99
102
  if env[HTTP_X_REQUEST_START]
100
103
  data[:request_latency] = ((began_at - env[HTTP_X_REQUEST_START].to_f) * 1000).round(3)
101
104
  end
@@ -133,6 +136,7 @@ module Kiev
133
136
  data[:error_class] = exception.class.name
134
137
  data[:error_message] = exception.message[0..5000]
135
138
  data[:error_backtrace] = Array(exception.backtrace).join(NEW_LINE)[0..5000]
139
+ data[:level] = LOG_ERROR
136
140
  end
137
141
  data
138
142
  end
@@ -4,6 +4,7 @@ module Kiev
4
4
  module RequestLogger
5
5
  module Mixin
6
6
  NEW_LINE = "\n"
7
+ LOG_ERROR = "ERROR"
7
8
 
8
9
  def wrap_request_logger(event, **data, &_block)
9
10
  began_at = Time.now
@@ -21,6 +22,7 @@ module Kiev
21
22
  data[:error_class] = error.class.name
22
23
  data[:error_message] = error.message[0..5000]
23
24
  data[:error_backtrace] = Array(error.backtrace).join(NEW_LINE)[0..5000]
25
+ data[:level] = LOG_ERROR
24
26
  end
25
27
 
26
28
  Kiev.event(event, data)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kiev
4
- VERSION = "4.2.0"
4
+ VERSION = "4.3.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.2.0
4
+ version: 4.3.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: 2020-02-13 00:00:00.000000000 Z
11
+ date: 2020-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -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: []
@@ -199,7 +199,7 @@ homepage: https://github.com/blacklane/kiev
199
199
  licenses:
200
200
  - MIT
201
201
  metadata: {}
202
- post_install_message:
202
+ post_install_message:
203
203
  rdoc_options: []
204
204
  require_paths:
205
205
  - lib
@@ -214,9 +214,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
- rubyforge_project:
218
- rubygems_version: 2.7.7
219
- signing_key:
217
+ rubygems_version: 3.0.3
218
+ signing_key:
220
219
  specification_version: 4
221
220
  summary: Distributed logging to JSON integrated with various Ruby frameworks and tools
222
221
  test_files: []