chef-solo-wrapper 0.0.9 → 0.0.10

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.
data/bin/cs CHANGED
@@ -16,7 +16,7 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- CHEF_SOLO_WRAPPER_VERSION = '0.0.9'
19
+ CHEF_SOLO_WRAPPER_VERSION = '0.0.10'
20
20
  COOKBOOKS_SRC_DEST = '/usr/src/chef-cookbooks'
21
21
 
22
22
  require 'rubygems'
@@ -0,0 +1,8 @@
1
+ class ChefSoloWrapper
2
+
3
+ def initialize(facility_log_level)
4
+ @facility_log_level = facility_log_level
5
+ puts "[#{`date`.strip}] Log level: #{facility_log_level.upcase}"
6
+ end
7
+
8
+ end
@@ -0,0 +1,40 @@
1
+ class EasyLogger
2
+
3
+ def initialize(facility_log_level='info')
4
+ @facility_log_level = facility_log_level
5
+ #puts "Facility Log level: #{facility_log_level.to_s.upcase}"
6
+ end
7
+
8
+ def log_level
9
+ puts @facility_log_level
10
+ end
11
+
12
+ def log(message, level='info')
13
+ render = false
14
+ #puts "msg: #{message}"
15
+ #puts "-log start-"
16
+ #puts "@facility_log_level=#{@facility_log_level}"
17
+ if level.kind_of?(Array)
18
+ #puts "level, #{level} is an array."
19
+ level = 'error' if level.include?('error')
20
+ level = 'verbose' if ( level.include?('verbose') && ! level.include?('debug') )
21
+ level = 'info' if level.include?('info')
22
+ level = 'debug' if level.include?('debug')
23
+ elsif level.kind_of?(String)
24
+ #puts 'level is a string.'
25
+ end
26
+ #puts "level asking to log is #{level}."
27
+ render = true if level == 'error'
28
+ render = true if (level == 'debug' and @facility_log_level == 'debug')
29
+ render = true if level == 'info'
30
+ render = true if level == 'verbose' and ( @facility_log_level == 'verbose' || @facility_log_level == 'debug' )
31
+ #puts "render: #{render}"
32
+ if render
33
+ puts "[#{`date`.strip}] #{level.upcase}: #{message}"
34
+ else
35
+ #puts "Discard log message: #{level.upcase}: #{message}" if @facility_log_level == 'debug'
36
+ end
37
+ #puts "-log finish-"
38
+ end
39
+
40
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-solo-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ version: 0.0.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Fordham
@@ -64,7 +64,9 @@ extensions: []
64
64
  extra_rdoc_files: []
65
65
 
66
66
  files:
67
+ - lib/chef_solo_wrapper.rb
67
68
  - lib/config_helper.rb
69
+ - lib/easy_logger.rb
68
70
  - lib/cookbooks_fetcher.rb
69
71
  - bin/cs
70
72
  homepage: https://github.com/flaccid/chef-solo-wrapper