diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-05-21 16:23:40 -0700 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-05-21 16:23:40 -0700 |
commit | 417baa62d0dc6379d7d7bb054731e3ca9cb226bd (patch) | |
tree | 719d3cfe5a1dcdf072086e27c4a3cddbd05a58ca | |
parent | 48f58b8ada1a446c1d4266cd8f87b96eac618bfa (diff) | |
parent | 77089abec2fe00113afe9c9f252c567b81db9f73 (diff) | |
download | mixlib-log-417baa62d0dc6379d7d7bb054731e3ca9cb226bd.tar.gz |
Merge pull request #7 from ketan/add-does-not-pass-args-correctly
Ensure that arguments to Mixlib::Log#add are passed as is to all loggers
-rw-r--r-- | lib/mixlib/log.rb | 2 | ||||
-rw-r--r-- | spec/mixlib/log_spec.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/mixlib/log.rb b/lib/mixlib/log.rb index aa477c8..5ff243d 100644 --- a/lib/mixlib/log.rb +++ b/lib/mixlib/log.rb @@ -133,7 +133,7 @@ module Mixlib end def add(severity, message = nil, progname = nil, &block) - loggers.each {|l| l.add(severity, message = nil, progname = nil, &block) } + loggers.each {|l| l.add(severity, message, progname, &block) } end alias :log :add diff --git a/spec/mixlib/log_spec.rb b/spec/mixlib/log_spec.rb index 1a4a33e..640ae81 100644 --- a/spec/mixlib/log_spec.rb +++ b/spec/mixlib/log_spec.rb @@ -130,6 +130,15 @@ describe Mixlib::Log do lambda { Logit.debug("Gimme some sugar!") }.should_not raise_error end + it "should pass add method calls directly to logger" do + logdev = StringIO.new + Logit.init(logdev) + Logit.level = :debug + Logit.should be_debug + lambda { Logit.add(Logger::DEBUG, "Gimme some sugar!") }.should_not raise_error + logdev.string.should match(/Gimme some sugar/) + end + it "should default to STDOUT if init is called with no arguments" do logger_mock = Struct.new(:formatter, :level).new Logger.stub!(:new).and_return(logger_mock) |