Skip to content
Browse files

[vcap_logging] fix passing blocks

Change-Id: I5cf53bf5f824aff32148828741c0441d04291641
  • Loading branch information...
1 parent 91c0765 commit 23c0a80a1897cfd454e3730c3d15f0c930359c34 @bnugmanov bnugmanov committed Feb 29, 2012
View
5 vcap_logging/lib/vcap/logging/logger.rb
@@ -46,7 +46,10 @@ def define_log_levels(levels)
# Needed in order to create a new scope when binding level to the blocks
def define_log_helper(level)
- define_method(level) {|*args| log(level, *args) }
+
+ define_method(level) {|*args,&block|
+ log(level, *args,&block)
+ }
end
def define_logf_helper(name, level)
View
2 vcap_logging/lib/vcap/logging/version.rb
@@ -1,5 +1,5 @@
module VCAP
module Logging
- VERSION = '0.1.5'
+ VERSION = '0.1.6'
end
end
View
7 vcap_logging/spec/unit/logger_spec.rb
@@ -63,10 +63,13 @@
it 'should use supplied blocks to generate log data' do
block_called = false
sink = mock(:sink)
- sink.should_receive(:add_record).with(an_instance_of(VCAP::Logging::LogRecord)).once
+ sink.should_receive(:add_record).with(an_instance_of(VCAP::Logging::LogRecord)).once do |record|
+ record.data.should == 'foo'
+ end
+
@sink_map.add_sink(nil, nil, sink)
@logger.log_level = :info
- @logger.log(:fatal) { block_called = true; 'foo' }
+ @logger.fatal { block_called = true; 'foo' }
block_called.should be_true
end

0 comments on commit 23c0a80

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