lsslog 0.1.1.pre.rc1 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b2f4d83d62f155cb54aadd1aced2ea3d9d130ecee5d6c21321d88f94196ca32
4
- data.tar.gz: 50ac184332e751d6ee7035eb907ebb1f501d979c28aeb45021634f7dd3332a84
3
+ metadata.gz: 38c42632c9b012618112b06f0b4e4a426727870dfcfca869817788ac6f24ebbb
4
+ data.tar.gz: 99ff0973360cebcb021c0bf2e2f948e9318e6898b17ddc8ad375915e557a732a
5
5
  SHA512:
6
- metadata.gz: b05b896c5ebb504249bf0950a4a1cc5b687d738646141948263f79427a0932c4e4bae91e1ed6907b1f6e709d83c51fa548be03d45f5994c3cccc463dddcedf95
7
- data.tar.gz: 3ff4d324d72c8a46fc4236493407c2c72f9cab031562929accce2a723327cff0d60a06e402eadaab1efb131398c588d48a222631fcf053b5975b0afe74247338
6
+ metadata.gz: 28e87422f7deedc55c73a1a634e7f413f2f5c2efbddd9595fbf06300415ffcfd883af1f24ff499ea2ba73c28e6a8324c4c1b166107869c5e96400aa175e07797
7
+ data.tar.gz: 6ff823b5b8eee6f3e422e0c2a7c4bdefa28da7bcd0b509271ea86582a6b9d0d5668e923e14721bf40c84679f75a2b46767e2463a7f13b003fd5f715fd4446f49
@@ -15,13 +15,21 @@ module Lsslog
15
15
 
16
16
  class << self
17
17
  attr_writer :configuration
18
- end
19
18
 
20
- def self.configuration
21
- @configuration ||= Configuration.new
22
- end
19
+ def logger
20
+ @@logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
21
+ end
22
+
23
+ def logger=(logger)
24
+ @@logger = logger
25
+ end
26
+
27
+ def configuration
28
+ @configuration ||= Configuration.new
29
+ end
23
30
 
24
- def self.configure
25
- yield(configuration)
31
+ def configure
32
+ yield(configuration)
33
+ end
26
34
  end
27
35
  end
@@ -11,7 +11,13 @@ module Lsslog
11
11
  end
12
12
 
13
13
  def self.call(*args)
14
- new.call(*args)
14
+ response = new.call(*args)
15
+
16
+ Lsslog.logger.info "#{self.name.demodulize}: #{response.to_json}"
17
+
18
+ response
19
+ rescue GRPC::BadStatus => e
20
+ Lsslog.logger.info "ERROR: #{e.message}"
15
21
  end
16
22
 
17
23
  private
@@ -19,6 +25,7 @@ module Lsslog
19
25
  def lss_host
20
26
  @lss_host ||= ::Lsslog.configuration.lss_host
21
27
  raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
28
+
22
29
  @lss_host
23
30
  end
24
31
  end
@@ -2,11 +2,7 @@ module Lsslog
2
2
  module Services
3
3
  class GetLssConfig < Base
4
4
  def call(flow_id = nil)
5
- response = client.get_lss_config(Lsslog::LssConfig.new(flow_id: flow_id))
6
- Rails.logger.info "GetLssConfig: #{response.to_json}"
7
- response
8
- rescue GRPC::BadStatus => e
9
- Rails.logger.info "ERROR: #{e.message}"
5
+ client.get_lss_config(Lsslog::LssConfig.new(flow_id: flow_id))
10
6
  end
11
7
  end
12
8
  end
@@ -2,11 +2,7 @@ module Lsslog
2
2
  module Services
3
3
  class GetVersion < Base
4
4
  def call
5
- response = client.get_version(Lsslog::EmptyIn.new)
6
- Rails.logger.info "GetVersion: #{response.to_json}"
7
- response
8
- rescue GRPC::BadStatus => e
9
- Rails.logger.info "ERROR: #{e.message}"
5
+ client.get_version(Lsslog::EmptyIn.new)
10
6
  end
11
7
  end
12
8
  end
@@ -2,10 +2,7 @@ module Lsslog
2
2
  module Services
3
3
  class RemoveLssConfig < Base
4
4
  def call(flow_id)
5
- response = client.remove_lss_config(Lsslog::LssConfig.new(flow_id: flow_id))
6
- Rails.logger.info "RemoveLssConfig: #{response.to_json}"
7
- rescue GRPC::BadStatus => e
8
- Rails.logger.info "ERROR: #{e.message}"
5
+ client.remove_lss_config(Lsslog::LssConfig.new(flow_id: flow_id))
9
6
  end
10
7
  end
11
8
  end
@@ -2,10 +2,7 @@ module Lsslog
2
2
  module Services
3
3
  class SetLssConfig < Base
4
4
  def call(config)
5
- response = client.set_lss_config(Lsslog::LssConfig.new(config))
6
- Rails.logger.info "SetLssConfig: #{response.to_json}"
7
- rescue GRPC::BadStatus => e
8
- Rails.logger.info "ERROR: #{e.message}"
5
+ client.set_lss_config(Lsslog::LssConfig.new(config))
9
6
  end
10
7
  end
11
8
  end
@@ -2,10 +2,7 @@ module Lsslog
2
2
  module Services
3
3
  class SetTransExpTime < Base
4
4
  def call(config)
5
- response = client.set_trans_exp_time(Lsslog::TransExpTime.new(config))
6
- Rails.logger.info "WriteLog: #{response.to_json}"
7
- rescue GRPC::BadStatus => e
8
- Rails.logger.info "ERROR: #{e.message}"
5
+ client.set_trans_exp_time(Lsslog::TransExpTime.new(config))
9
6
  end
10
7
  end
11
8
  end
@@ -2,10 +2,7 @@ module Lsslog
2
2
  module Services
3
3
  class WriteLog < Base
4
4
  def call(message)
5
- response = client.write_log(Lsslog::LssLog.new(message))
6
- Rails.logger.info "WriteLog: #{response.to_json}"
7
- rescue GRPC::BadStatus => e
8
- Rails.logger.info "ERROR: #{e.message}"
5
+ client.write_log(Lsslog::LssLog.new(message))
9
6
  end
10
7
  end
11
8
  end
@@ -1,3 +1,3 @@
1
1
  module Lsslog
2
- VERSION = "0.1.1-rc1"
2
+ VERSION = "0.1.1"
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.1.pre.rc1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thanh Ngo
@@ -122,9 +122,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ">"
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
- version: 1.3.1
127
+ version: '0'
128
128
  requirements: []
129
129
  rubygems_version: 3.1.2
130
130
  signing_key: