lsslog 0.1.7.3 → 0.1.7.6

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: b1e3cd848738dd177c5105960d399bd655dc62bb2407db83a3fc5face17bb0f8
4
+ data.tar.gz: cbe9200c2c002b4facc4d2a2b92300dca3fa4bd46dc975ead758777a534d56a0
5
5
  SHA512:
6
- metadata.gz: d8b225bbedef30446b9c6425520c24e31eb0cd020ee4e98b35d8a7bb4bba2983ee6ebaf72ddb137574c7a91aaed92bf106667de4632d90afbd27339301ac08f9
7
- data.tar.gz: 82acc3d92449b5a16a748093dda6bed9d99eb2d73e55acc504fa342225f663f5cb704e1ed1a8f41cb85946c67050aeee0c4ae5ccc762c69ad57e1342fb04e795
6
+ metadata.gz: 9a9f2b2451c3c697fb53119815b826ef243f38ffe2b358642eaefe8a58af249862c1fabfe24ba2e0c6a08796139b5254a7256e20b67a247524c113a457f9a73e
7
+ data.tar.gz: e44d12cd9d1653713486b812dc824faa6315a7e3f5d2fc11afac3134fe602f36cbbb45d8db1b70962d8be82d4e1304ca464a02af544b553d5db06c1b5f11c2e6
data/lib/lsslog/v2/log.rb CHANGED
@@ -3,62 +3,63 @@ 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
+ Rails.logger.info("Begin log function")
13
+ message_struct = hash_to_struct(message_h)
14
14
 
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
- )
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
+ )
22
22
 
23
- Rails.logger.info("Sending LSS log. Message:[#{message_h}]")
23
+ Rails.logger.info("Sending LSS log. Message:[#{message_h}]")
24
24
 
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
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
+ rescue StandardError => e
31
+ Rails.logger.info("#{e.backtrace}, #{e.message}")
32
+ end
31
33
 
32
- private
34
+ private
33
35
 
34
- def lss_host
35
- @lss_host ||= ::Lsslog.configuration.lss_host
36
- raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
36
+ def lss_host
37
+ @lss_host ||= ::Lsslog.configuration.lss_host
38
+ raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
37
39
 
38
- @lss_host
39
- end
40
+ @lss_host
41
+ end
40
42
 
41
- def hash_to_struct(hash)
42
- Google::Protobuf::Struct.new(fields: hash.transform_values { |v| to_proto_value(v) })
43
- end
43
+ def hash_to_struct(hash)
44
+ Google::Protobuf::Struct.new(fields: hash.transform_values { |v| to_proto_value(v) })
45
+ end
44
46
 
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
47
+ def to_proto_value(value)
48
+ case value
49
+ when String
50
+ Google::Protobuf::Value.new(string_value: value)
51
+ when Numeric
52
+ Google::Protobuf::Value.new(number_value: value)
53
+ when TrueClass, FalseClass
54
+ Google::Protobuf::Value.new(bool_value: value)
55
+ when Hash
56
+ Google::Protobuf::Value.new(struct_value: hash_to_struct(value))
57
+ when Array
58
+ Google::Protobuf::Value.new(list_value: Google::Protobuf::ListValue.new(values: value.map { |v| to_proto_value(v) }))
59
+ when NilClass
60
+ Google::Protobuf::Value.new(null_value: :NULL_VALUE)
61
+ else
62
+ Google::Protobuf::Value.new(string_value: value.to_s)
62
63
  end
63
64
  end
64
65
  end
@@ -1,3 +1,3 @@
1
1
  module Lsslog
2
- VERSION = "0.1.7.3"
2
+ VERSION = "0.1.7.6"
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.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thanh Ngo