lsslog 0.1.7.1 → 0.1.7.3

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: 24b6c0d3edd020f2d9d8527691fed2e5cb7a820a26243a0cc1c8438dd97a900d
4
- data.tar.gz: 2f6451ed62719c71a9981c335916ac79a369114b1c3b4be8cfdec5787bc7a1e5
3
+ metadata.gz: 04c1abdd2488db0239f233f3e6d58ff7cb5a553cf8445733957fb2da77846788
4
+ data.tar.gz: '09f28e027d8e102f22e6d72062de695c210475521c7d7980866d24540aef2f0a'
5
5
  SHA512:
6
- metadata.gz: 1e329ef42a2419c148a35e3f2fd976b9ac8c6fbacf102eb3e99e39527340dfb861f7e045136bd5c3d57e640b733e946c4707ca03dbff4aa682b522084766a5fd
7
- data.tar.gz: b149a28e7aa28712cfbfbe0919c66ad8e814deb28e1b4a0f2daf04bc749374b9ab5168ac60c5069c0fa876e65a1195b5889828d90923b0d9b3a444be96f444a1
6
+ metadata.gz: d8b225bbedef30446b9c6425520c24e31eb0cd020ee4e98b35d8a7bb4bba2983ee6ebaf72ddb137574c7a91aaed92bf106667de4632d90afbd27339301ac08f9
7
+ data.tar.gz: 82acc3d92449b5a16a748093dda6bed9d99eb2d73e55acc504fa342225f663f5cb704e1ed1a8f41cb85946c67050aeee0c4ae5ccc762c69ad57e1342fb04e795
data/lib/lsslog/v2/log.rb CHANGED
@@ -3,60 +3,62 @@ require 'lsslog_services_pb'
3
3
 
4
4
  module Lsslog
5
5
  module V2
6
- class Service
7
- def initialize
8
- @stub = Lsslog::V2::Stub.new(lss_host, :this_channel_is_insecure)
9
- end
6
+ module Service
7
+ class Log
8
+ def initialize
9
+ @stub = Lsslog::V2::Stub.new(lss_host, :this_channel_is_insecure)
10
+ end
10
11
 
11
- def log(message_h:, severity:, component: '', api: '')
12
- message_struct = hash_to_struct(message_h)
12
+ def self.call(message_h:, severity:, component: '', api: '')
13
+ message_struct = hash_to_struct(message_h)
13
14
 
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
- )
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
+ )
21
22
 
22
- Rails.logger.info("Sending LSS log. Message:[#{message_h}]")
23
+ Rails.logger.info("Sending LSS log. Message:[#{message_h}]")
23
24
 
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
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
30
31
 
31
- private
32
+ private
32
33
 
33
- def lss_host
34
- @lss_host ||= ::Lsslog.configuration.lss_host
35
- raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
34
+ def lss_host
35
+ @lss_host ||= ::Lsslog.configuration.lss_host
36
+ raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
36
37
 
37
- @lss_host
38
- end
38
+ @lss_host
39
+ end
39
40
 
40
- def hash_to_struct(hash)
41
- Google::Protobuf::Struct.new(fields: hash.transform_values { |v| to_proto_value(v) })
42
- end
41
+ def hash_to_struct(hash)
42
+ Google::Protobuf::Struct.new(fields: hash.transform_values { |v| to_proto_value(v) })
43
+ end
43
44
 
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)
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
60
62
  end
61
63
  end
62
64
  end
@@ -1,3 +1,3 @@
1
1
  module Lsslog
2
- VERSION = "0.1.7.1"
2
+ VERSION = "0.1.7.3"
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.1
4
+ version: 0.1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thanh Ngo