Using warning, the deprecation warnings will appear in logs and in color. Paired-With: Jesse Wolfe
Signed-off-by: Nick Lewis <n...@puppetlabs.com> --- Local-branch: ticket/next/5027 lib/puppet/util/logging.rb | 2 +- spec/unit/util/logging_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet/util/logging.rb b/lib/puppet/util/logging.rb index 36eb43c..4e76ae4 100644 --- a/lib/puppet/util/logging.rb +++ b/lib/puppet/util/logging.rb @@ -18,7 +18,7 @@ module Puppet::Util::Logging def deprecation_warning(message) $deprecation_warnings ||= Hash.new(0) if $deprecation_warnings.length < 100 and ($deprecation_warnings[message] += 1) == 1 - warn message + warning message end end diff --git a/spec/unit/util/logging_spec.rb b/spec/unit/util/logging_spec.rb index 63f0a4d..bc2eaff 100755 --- a/spec/unit/util/logging_spec.rb +++ b/spec/unit/util/logging_spec.rb @@ -99,21 +99,21 @@ describe Puppet::Util::Logging do end it "should the message with warn" do - @logger.expects(:warn).with('foo') + @logger.expects(:warning).with('foo') @logger.deprecation_warning 'foo' end it "should only log each unique message once" do - @logger.expects(:warn).with('foo').once + @logger.expects(:warning).with('foo').once 5.times { @logger.deprecation_warning 'foo' } end it "should only log the first 100 messages" do (1..100).each { |i| - @logger.expects(:warn).with(i).once + @logger.expects(:warning).with(i).once @logger.deprecation_warning i } - @logger.expects(:warn).with(101).never + @logger.expects(:warning).with(101).never @logger.deprecation_warning 101 end end -- 1.7.4.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.