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:
parent
fc4a917b71
commit
c53d85fac5
@ -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
|
||||
|
||||
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user