svcbase 0.1.17 → 0.1.18
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 +4 -4
- data/.ruby-version +1 -1
- data/lib/svcbase/corelogger.rb +1 -0
- data/lib/svcbase/middleware/apilogger.rb +4 -19
- data/lib/svcbase/version.rb +1 -1
- data/svcbase.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93985e29a90a69f1adeb0fc43bbe1875873233920b9bb4cc014e56e682ce3b40
|
|
4
|
+
data.tar.gz: 154078cf8d4616cd29a1fdd9478ed41d6f5dd6378af240f3e163e351c67747d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b8a602a0d9b9d7fdd930ee29afd9657e82b5585f419fda5b42c4fff5be850ef108d3a1b934233d7dc02f0f7dc2a4f2541dc405033c830a1b3101eac435b8fbe
|
|
7
|
+
data.tar.gz: dc323268320eaa9bfb2d64cded8392d8c38dbe6b6d588c2c5f56f62d90cdca2bd6e061f8b36bc23e61998637354cfe9d27ffac9a9ac24c6b9cd76475296fc7ea
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.5.1
|
data/lib/svcbase/corelogger.rb
CHANGED
|
@@ -66,7 +66,7 @@ module Core
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# only suppress if successful and we didn't take too long
|
|
69
|
-
return if
|
|
69
|
+
return if (status == 304 || (200..299).cover?(status)) && !request_took_too_long && suppress?(status)
|
|
70
70
|
|
|
71
71
|
r = env[Grape::Env::GRAPE_REQUEST]
|
|
72
72
|
|
|
@@ -74,26 +74,19 @@ module Core
|
|
|
74
74
|
path: r.path, route: processed_by, api_id: auth_id,
|
|
75
75
|
params: filtered_parameters,
|
|
76
76
|
elapsed: elapsed_time,
|
|
77
|
+
ref: request.env['HTTP_X_REQUEST_ID'],
|
|
77
78
|
ip: request.env['HTTP_X_FORWARDED_FOR'] || request.env['REMOTE_ADDR'],
|
|
78
79
|
ua: request.env['HTTP_USER_AGENT'] }
|
|
79
80
|
|
|
80
81
|
log.warn "#{processed_by} request took #{elapsed_time} msec" if request_took_too_long
|
|
81
|
-
|
|
82
|
-
if successful?(status)
|
|
83
|
-
if suppress_path?(r.path)
|
|
84
|
-
log.debug info
|
|
85
|
-
else
|
|
86
|
-
log.info info
|
|
87
|
-
end
|
|
88
|
-
else
|
|
89
|
-
log.error info
|
|
90
|
-
end
|
|
82
|
+
log.info info
|
|
91
83
|
end
|
|
92
84
|
# rubocop:enable AbcSize
|
|
93
85
|
|
|
94
86
|
#
|
|
95
87
|
# Helpers
|
|
96
88
|
#
|
|
89
|
+
|
|
97
90
|
private def suppress?(status)
|
|
98
91
|
return true if get_route_option(:suppress_log)
|
|
99
92
|
# create either an array with the oid, or an empty array
|
|
@@ -188,13 +181,5 @@ module Core
|
|
|
188
181
|
private def request
|
|
189
182
|
@request ||= ::Rack::Request.new(env)
|
|
190
183
|
end
|
|
191
|
-
|
|
192
|
-
private def suppress_path?(path)
|
|
193
|
-
path =~ %r{^/v1/health$|^/v1/ping$}
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
private def successful?(status)
|
|
197
|
-
(status == 304 || (200..299).cover?(status))
|
|
198
|
-
end
|
|
199
184
|
end
|
|
200
185
|
end
|
data/lib/svcbase/version.rb
CHANGED
data/svcbase.gemspec
CHANGED
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
19
|
if spec.respond_to?(:metadata)
|
|
20
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org
|
|
20
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
21
21
|
else
|
|
22
22
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
|
23
23
|
'public gem pushes.'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: svcbase
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joe Nardone
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -282,7 +282,7 @@ files:
|
|
|
282
282
|
homepage: http://no
|
|
283
283
|
licenses: []
|
|
284
284
|
metadata:
|
|
285
|
-
allowed_push_host: https://rubygems.org
|
|
285
|
+
allowed_push_host: https://rubygems.org
|
|
286
286
|
post_install_message:
|
|
287
287
|
rdoc_options: []
|
|
288
288
|
require_paths:
|
|
@@ -298,7 +298,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
298
298
|
- !ruby/object:Gem::Version
|
|
299
299
|
version: '0'
|
|
300
300
|
requirements: []
|
|
301
|
-
|
|
301
|
+
rubyforge_project:
|
|
302
|
+
rubygems_version: 2.7.6
|
|
302
303
|
signing_key:
|
|
303
304
|
specification_version: 4
|
|
304
305
|
summary: Base service code
|