gruf 2.3.0 → 2.4.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
- SHA1:
3
- metadata.gz: d13a8ed53bfc2a83d33c7ca8eed57d302019d9b7
4
- data.tar.gz: c665d27586c8c446071275b1490c6814391e7f49
2
+ SHA256:
3
+ metadata.gz: 1af99f62622489376979d133e0c11fe33957a3937941193187508158bfb73398
4
+ data.tar.gz: 4b280b7a654de95dc0fc2d7ce8562baace9a9bd46861ccd59178682814a43e23
5
5
  SHA512:
6
- metadata.gz: 18b6a5bb4cc864ec8f9dd66428fd08843d71b27a5c61706f4d352e2554644b9e9062e37c8e165917c021cc1970560099920e8f7f3be0149f60b18fa35e86c02c
7
- data.tar.gz: 6432ce2af8567422c3ee0dce084bac1f6100536421f4f93cfee554dd78384f989ac163247d81a52c3043123d06a4e841337198bb9e6a4cf2ce4dbdf36410cce2
6
+ metadata.gz: 75f137a4d62bbbc3169338517c12c9b2bb3bb8a60def87ee7f0ee096cad9f8752660ed7a4367f118d7dfa05c87901a1fd543ee728a9ac273816b2014feb0f6fa
7
+ data.tar.gz: 3337ab3f9da018e445e245beaaa2d4af7307d31d9182f758e4e6adcbb348c31fd7862bafce81e2eabca7ba02d7b7b678bf0abaa782ffedc8b77a6adb0339a59d
@@ -2,6 +2,12 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 2.4.0
6
+
7
+ - Added a hash of error log levels to RequestLogging interceptor, mapping error code to level of logging to use. To
8
+ override the level of logging per error response, provide a map of codes to log level in options, key :log_levels.
9
+ The default is :error log level.
10
+
5
11
  ### 2.3.0
6
12
 
7
13
  - Add Gruf::Interceptors::ClientInterceptor for intercepting outbound client calls
@@ -37,6 +37,22 @@ module Gruf
37
37
  #
38
38
  class Interceptor < ::Gruf::Interceptors::ServerInterceptor
39
39
 
40
+ # Default mappings of codes to log levels...
41
+ LOG_LEVEL_MAP = { 'GRPC::Ok' => :info,
42
+ 'GRPC::InvalidArgument' => :info,
43
+ 'GRPC::NotFound' => :info,
44
+ 'GRPC::AlreadyExists' => :info,
45
+ 'GRPC::OutOfRange' => :info,
46
+ 'GRPC::Unauthenticated' => :warn,
47
+ 'GRPC::PermissionDenied' => :warn,
48
+ 'GRPC::Unknown' => :error,
49
+ 'GRPC::Internal' => :error,
50
+ 'GRPC::DataLoss' => :error,
51
+ 'GRPC::FailedPrecondition' => :error,
52
+ 'GRPC::Unavailable' => :error,
53
+ 'GRPC::DeadlineExceeded' => :error,
54
+ 'GRPC::Cancelled' => :error }.freeze
55
+
40
56
  ###
41
57
  # Log the request, sending it to the appropriate formatter
42
58
  #
@@ -49,11 +65,15 @@ module Gruf
49
65
  yield
50
66
  end
51
67
 
68
+ # Fetch log level options and merge with default...
69
+ log_level_map = LOG_LEVEL_MAP.merge(options.fetch(:log_levels, {}))
70
+
71
+ # A result is either successful, or, some level of feedback handled in the else block...
52
72
  if result.successful?
53
- type = options.fetch(:success_log_level, :info).to_sym
73
+ type = :info
54
74
  status_name = 'GRPC::Ok'
55
75
  else
56
- type = options.fetch(:failure_log_level, :error).to_sym
76
+ type = log_level_map[result.message_class_name] || :error
57
77
  status_name = result.message_class_name
58
78
  end
59
79
 
@@ -14,5 +14,5 @@
14
14
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
15
  #
16
16
  module Gruf
17
- VERSION = '2.3.0'.freeze
17
+ VERSION = '2.4.0'.freeze
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-29 00:00:00.000000000 Z
11
+ date: 2018-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.6.13
178
+ rubygems_version: 2.7.7
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: gRPC Ruby Framework