togls 3.1.0 → 3.2.0

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
  SHA1:
3
- metadata.gz: 36ef883a795a19707197ea6046f416d6a6bd5b74
4
- data.tar.gz: 5abdefa249cdb62acd2bd8476e1a325ef943e4d7
3
+ metadata.gz: 5656ae6b55d75e746b8f76289a56bdad7f2abd0f
4
+ data.tar.gz: 796aeadd5ff7da40c31ad2e5dec9bd2c4fcec409
5
5
  SHA512:
6
- metadata.gz: cf6fb3ef4ab174ff2a9c640206ae598c3f735961371feeed3bf71fdc48cd836db16c3cce35345f906c13c7105fc3de3c8ee880bdba77e64572f82ad85ba4e149
7
- data.tar.gz: 089ec8cf82999525881f113ba18aab1c607ab0b039c2a08f234495dcc16b1f97914ffd2e6c46cf0b55ceaf54b406a694bbdabd576965d5b34040a60d4ca80a95
6
+ metadata.gz: 55ea4cf6a8738b9199ee6f17a453eadaf4c4b987d76fd11b6bea86f5903bad2c14e2831f148df098dc3293a26aa0efcbab1abf43392e29899c7dd153c56733a6
7
+ data.tar.gz: baac92d2f9ed7af9c6e6efd97423ebb7e934f5570d593c6a82740e1cdf949ea5101089b06b800384f226dcbe9ddd2f998b0c8781c95f0ca4cc18f91200ecc218
data/CHANGELOG.md CHANGED
@@ -10,6 +10,11 @@ that you can set version constraints properly.
10
10
 
11
11
  #### [Unreleased] - now
12
12
 
13
+ #### [v3.2.0] - 2016-10-27
14
+
15
+ * `Added`: toggle evelaution logging
16
+ * `Changed`: debug logging to warn logging
17
+
13
18
  #### [v3.1.0] - 2016-10-26
14
19
 
15
20
  * `Changed`: `optional_logger` to v2.0.0
@@ -125,7 +130,8 @@ that you can set version constraints properly.
125
130
  feature toggles
126
131
  * `Added`: basic feature toggles able to be switched on/off
127
132
 
128
- [Unreleased]: https://github.com/codebreakdown/togls/compare/v3.1.0...HEAD
133
+ [Unreleased]: https://github.com/codebreakdown/togls/compare/v3.2.0...HEAD
134
+ [v3.2.0]: https://github.com/codebreakdown/togls/compare/v3.2.0...v3.1.0
129
135
  [v3.1.0]: https://github.com/codebreakdown/togls/compare/v3.1.0...v3.0.0
130
136
  [v3.0.0]: https://github.com/codebreakdown/togls/compare/v2.2.1...v3.0.0
131
137
  [v2.2.1]: https://github.com/codebreakdown/togls/compare/v2.2.0...v2.2.1
@@ -53,18 +53,18 @@ module Togls
53
53
 
54
54
  def validate_feature_data(feature_data)
55
55
  if feature_data.nil?
56
- Togls.logger.debug("None of the feature repository drivers claim to have the feature")
56
+ Togls.logger.warn("None of the feature repository drivers claim to have the feature")
57
57
  raise Togls::RepositoryFeatureDataInvalid, "None of the feature repository drivers claim to have the feature"
58
58
  end
59
59
 
60
60
  ['key', 'description', 'target_type'].each do |k|
61
61
  if !feature_data.has_key? k
62
- Togls.logger.debug("One of the feature repository drivers returned feature data that is missing the '#{k}'")
62
+ Togls.logger.warn("One of the feature repository drivers returned feature data that is missing the '#{k}'")
63
63
  raise Togls::RepositoryFeatureDataInvalid, "One of the feature repository drivers returned feature data that is missing the '#{k}'"
64
64
  end
65
65
 
66
66
  if !feature_data[k].is_a?(String)
67
- Togls.logger.debug("One of the feature repository drivers returned feature data with '#{k}' not being a string")
67
+ Togls.logger.warn("One of the feature repository drivers returned feature data with '#{k}' not being a string")
68
68
  raise Togls::RepositoryFeatureDataInvalid, "One of the feature repository drivers returned feature data with '#{k}' not being a string"
69
69
  end
70
70
  end
@@ -48,20 +48,20 @@ module Togls
48
48
 
49
49
  def validate_rule_data(rule_data)
50
50
  if rule_data.nil?
51
- Togls.logger.debug "None of the rule repository drivers claim to have the rule"
51
+ Togls.logger.warn "None of the rule repository drivers claim to have the rule"
52
52
  raise Togls::RepositoryRuleDataInvalid, "None of the rule repository drivers claim to have the rule"
53
53
  end
54
54
 
55
55
  ['id', 'type_id', 'data', 'target_type'].each do |k|
56
56
  if !rule_data.has_key? k
57
- Togls.logger.debug "One of the rule repository drivers returned rule data that is missing the '#{k}'"
57
+ Togls.logger.warn "One of the rule repository drivers returned rule data that is missing the '#{k}'"
58
58
  raise Togls::RepositoryRuleDataInvalid, "One of the rule repository drivers returned rule data that is missing the '#{k}'"
59
59
  end
60
60
  end
61
61
 
62
62
  ['id', 'type_id', 'target_type'].each do |k|
63
63
  if !rule_data[k].is_a?(String)
64
- Togls.logger.debug "One of the rule repository drivers returned rule data with '#{k}' not being a string"
64
+ Togls.logger.warn "One of the rule repository drivers returned rule data with '#{k}' not being a string"
65
65
  raise Togls::RepositoryRuleDataInvalid, "One of the rule repository drivers returned rule data with '#{k}' not being a string"
66
66
  end
67
67
  end
data/lib/togls/toggle.rb CHANGED
@@ -71,12 +71,16 @@ module Togls
71
71
 
72
72
  def on?(target = nil)
73
73
  validate_target(target)
74
- @rule.run(@feature.key, target)
74
+ result = @rule.run(@feature.key, target)
75
+ Togls.logger.info("Togls evaluated feature(#{@feature.key}).on?(#{target.inspect}) to #{result.inspect} using rule, #{@rule.id}.")
76
+ result
75
77
  end
76
78
 
77
79
  def off?(target = nil)
78
80
  validate_target(target)
79
- !@rule.run(@feature.key, target)
81
+ result = !@rule.run(@feature.key, target)
82
+ Togls.logger.info("Togls evaluated feature(#{@feature.key}).off?(#{target.inspect}) to #{result.inspect} using rule, #{@rule.id}.")
83
+ result
80
84
  end
81
85
  end
82
86
  end
data/lib/togls/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Togls
2
- VERSION = '3.1.0'.freeze
2
+ VERSION = '3.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togls
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Miller