Permalink
Browse files

make logging a bit friendlier and cleanup messages

  • Loading branch information...
kisoku committed Feb 10, 2012
1 parent 2964f8f commit e609d1a5c186de3ae8b61901cf0298c7dc7c9770
Showing with 12 additions and 5 deletions.
  1. +6 −1 bin/whisk
  2. +4 −2 lib/whisk/bowl.rb
  3. +2 −2 lib/whisk/flavour/git.rb
View
@@ -24,7 +24,12 @@ require 'logger'
require 'whisk/config'
require 'whisk/log'
-Whisk::Log.logger = Logger.new(STDOUT)
+# borrowed from chef/chef/lib/chef/application.rb
+logger = Logger.new(STDOUT)
+STDOUT.sync = true
+logger.formatter = Whisk::Log.logger.formatter
+Whisk::Log::Formatter.show_time = false
+Whisk::Log.loggers << logger
whiskfile = File.join(ENV['HOME'], '.chef', 'whisk.rb')
View
@@ -42,7 +42,7 @@ def path(pth=nil)
def ingredient(iname, opts = {})
if ingredients.has_key? iname
- raise ArgumentError "ingredient #{iname} has already added to bowl #{name}"
+ raise ArgumentError "ingredient '#{iname}' has already added to bowl '#{name}'"
else
source = opts.delete :source
flavour = opts.delete :flavour
@@ -55,7 +55,7 @@ def ingredient(iname, opts = {})
def create
unless File.exists? path
begin
- Whisk::Log.info "Creating bowl #{name} with path #{path}"
+ Whisk::Log.info "creating bowl '#{name}' with path #{path}"
::FileUtils.mkdir_p path
rescue Exception => e
puts "#{e.backtrace} #{e.message}"
@@ -67,6 +67,8 @@ def prepare
self.create unless File.exists? path
::Dir.chdir path
+ Whisk::Log.info "preparing bowl '#{name}' with path #{path}"
+
ingredients.keys.each do |i|
begin
ingredients[i].prepare
View
@@ -33,7 +33,7 @@ def clone
end
def checkout(ref="master")
- Whisk::Log.info "checking out ref #{ref} for ingredient #{self.name}"
+ Whisk::Log.info "checking out ref '#{ref}' for ingredient #{self.name}"
shell_out("git checkout #{ref}")
end
@@ -43,7 +43,7 @@ def pre_fetch
end
def fetch
- Whisk::Log.info "fetching ingredient #{self.name}, from git url #{self.source}"
+ Whisk::Log.info "fetching ingredient '#{self.name}', from git url #{self.source}"
shell_out("git fetch --all")
end

0 comments on commit e609d1a

Please sign in to comment.