Skip to content
Browse files

Honor Barista#verbose when determining to log debug messages

  • Loading branch information...
1 parent f511ab0 commit 0a043ab083f2b7279aee8a976ca0cd6241a4cd45 @mnoble mnoble committed Feb 26, 2012
Showing with 14 additions and 1 deletion.
  1. +1 −1 lib/barista.rb
  2. +13 −0 spec/barista_spec.rb
View
2 lib/barista.rb
@@ -225,7 +225,7 @@ def output_path_for(file)
end
def debug(message)
- logger.debug "[Barista] #{message}" if logger
+ logger.debug "[Barista] #{message}" if logger && verbose?
end
def setup_defaults
View
13 spec/barista_spec.rb
@@ -62,6 +62,19 @@
Barista::compile_all!
File.exist?(File.join(@public_path, "alert.js")).should be_true
end
+ it "logs when verbose is true" do
+ log = StringIO.new
+ Barista.logger = Logger.new(log)
+ Barista.compile_all!
+ log.string.should =~ /\[Barista\].+/
+ end
+ it "does not log when verbose is false" do
+ log = StringIO.new
+ Barista.logger = Logger.new(log)
+ Barista.verbose = false
+ Barista.compile_all!
+ log.string.should be_empty
+ end
end
end

0 comments on commit 0a043ab

Please sign in to comment.
Something went wrong with that request. Please try again.