lsslog 0.1.7.3 → 0.1.7.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of lsslog might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04c1abdd2488db0239f233f3e6d58ff7cb5a553cf8445733957fb2da77846788
4
- data.tar.gz: '09f28e027d8e102f22e6d72062de695c210475521c7d7980866d24540aef2f0a'
3
+ metadata.gz: 45af497aead3a63d0421a1232f375324d58e76efce648b857682d1ae68e186bb
4
+ data.tar.gz: cb82998326af48c6ce3169e4c82f1a77d760cf5455f9a5e0960c62fee00f3042
5
5
  SHA512:
6
- metadata.gz: d8b225bbedef30446b9c6425520c24e31eb0cd020ee4e98b35d8a7bb4bba2983ee6ebaf72ddb137574c7a91aaed92bf106667de4632d90afbd27339301ac08f9
7
- data.tar.gz: 82acc3d92449b5a16a748093dda6bed9d99eb2d73e55acc504fa342225f663f5cb704e1ed1a8f41cb85946c67050aeee0c4ae5ccc762c69ad57e1342fb04e795
6
+ metadata.gz: 2cf6cd3ace2d9f2c14a2b3c6ad6e35a3833d52320cc5447039a640f6b8ed838a72cb75b4eea214d19d1e41b5cb00baccff2d4be62554b90900b7dcf463b374e1
7
+ data.tar.gz: 6653e1f22e72010afd43c82f931e586102c6b24c220fcdd85785d41bddff2d31425f8a99dfd501f3d2f183ce26a539b81ad76178ecdb45216ad71cb227868161
data/lib/lsslog/v2/log.rb CHANGED
@@ -3,62 +3,60 @@ require 'lsslog_services_pb'
3
3
 
4
4
  module Lsslog
5
5
  module V2
6
- module Service
7
- class Log
8
- def initialize
9
- @stub = Lsslog::V2::Stub.new(lss_host, :this_channel_is_insecure)
10
- end
6
+ class Service
7
+ def initialize
8
+ @stub = Lsslog::V2::Stub.new(lss_host, :this_channel_is_insecure)
9
+ end
11
10
 
12
- def self.call(message_h:, severity:, component: '', api: '')
13
- message_struct = hash_to_struct(message_h)
11
+ def log(message_h:, severity:, component: '', api: '')
12
+ message_struct = hash_to_struct(message_h)
14
13
 
15
- log_ver2 = Lsslog::LogVer2.new(
16
- severity: severity,
17
- timestamp: Time.now.utc.iso8601,
18
- api: api,
19
- component: component,
20
- message: message_struct
21
- )
14
+ log_ver2 = Lsslog::LogVer2.new(
15
+ severity: severity,
16
+ timestamp: Time.now.utc.iso8601,
17
+ api: api,
18
+ component: component,
19
+ message: message_struct
20
+ )
22
21
 
23
- Rails.logger.info("Sending LSS log. Message:[#{message_h}]")
22
+ Rails.logger.info("Sending LSS log. Message:[#{message_h}]")
24
23
 
25
- response = @stub.log(log_ver2, deadline: Time.now + 5)
26
- response
27
- rescue GRPC::BadStatus => e
28
- Rails.logger.error("Error sending LSS log: #{e.message}")
29
- nil
30
- end
24
+ response = @stub.log(log_ver2, deadline: Time.now + 5)
25
+ response
26
+ rescue GRPC::BadStatus => e
27
+ Rails.logger.error("Error sending LSS log: #{e.message}")
28
+ nil
29
+ end
31
30
 
32
- private
31
+ private
33
32
 
34
- def lss_host
35
- @lss_host ||= ::Lsslog.configuration.lss_host
36
- raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
33
+ def lss_host
34
+ @lss_host ||= ::Lsslog.configuration.lss_host
35
+ raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
37
36
 
38
- @lss_host
39
- end
37
+ @lss_host
38
+ end
40
39
 
41
- def hash_to_struct(hash)
42
- Google::Protobuf::Struct.new(fields: hash.transform_values { |v| to_proto_value(v) })
43
- end
40
+ def hash_to_struct(hash)
41
+ Google::Protobuf::Struct.new(fields: hash.transform_values { |v| to_proto_value(v) })
42
+ end
44
43
 
45
- def to_proto_value(value)
46
- case value
47
- when String
48
- Google::Protobuf::Value.new(string_value: value)
49
- when Numeric
50
- Google::Protobuf::Value.new(number_value: value)
51
- when TrueClass, FalseClass
52
- Google::Protobuf::Value.new(bool_value: value)
53
- when Hash
54
- Google::Protobuf::Value.new(struct_value: hash_to_struct(value))
55
- when Array
56
- Google::Protobuf::Value.new(list_value: Google::Protobuf::ListValue.new(values: value.map { |v| to_proto_value(v) }))
57
- when NilClass
58
- Google::Protobuf::Value.new(null_value: :NULL_VALUE)
59
- else
60
- Google::Protobuf::Value.new(string_value: value.to_s)
61
- end
44
+ def to_proto_value(value)
45
+ case value
46
+ when String
47
+ Google::Protobuf::Value.new(string_value: value)
48
+ when Numeric
49
+ Google::Protobuf::Value.new(number_value: value)
50
+ when TrueClass, FalseClass
51
+ Google::Protobuf::Value.new(bool_value: value)
52
+ when Hash
53
+ Google::Protobuf::Value.new(struct_value: hash_to_struct(value))
54
+ when Array
55
+ Google::Protobuf::Value.new(list_value: Google::Protobuf::ListValue.new(values: value.map { |v| to_proto_value(v) }))
56
+ when NilClass
57
+ Google::Protobuf::Value.new(null_value: :NULL_VALUE)
58
+ else
59
+ Google::Protobuf::Value.new(string_value: value.to_s)
62
60
  end
63
61
  end
64
62
  end
@@ -1,3 +1,3 @@
1
1
  module Lsslog
2
- VERSION = "0.1.7.3"
2
+ VERSION = "0.1.7.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lsslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7.3
4
+ version: 0.1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thanh Ngo