1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Forward Logger#tag to the current Buffer

This commit is contained in:
Holger Just 2017-07-21 16:57:44 +02:00
parent fc4a917b71
commit c53d85fac5
2 changed files with 20 additions and 0 deletions

View File

@ -143,6 +143,11 @@ module Rackstash
@sink.reopen
end
# (see Buffer#tag)
def tag(*tags, scope: nil)
buffer.tag(*tags, scope: scope)
end
# (see Buffer#tags)
def tags
buffer.tags

View File

@ -193,6 +193,21 @@ describe Rackstash::Logger do
end
end
describe '#tag' do
it 'forwards to the buffer' do
buffer = instance_double('Rackstash::Buffer')
expect(logger).to receive(:buffer).and_return(buffer)
expect(buffer).to receive(:tag)
logger.tag('foo')
end
it 'implements the same method signature as the Buffer' do
expect(Rackstash::Buffer.instance_method(:tag).arity)
.to eql logger.method(:tag).arity
end
end
describe '#tags' do
it 'gets the current buffer\'s tags' do
buffer = instance_double('Rackstash::Buffer')