diff --git a/lib/rackstash/logger.rb b/lib/rackstash/logger.rb index a9429c3..4afcdf1 100644 --- a/lib/rackstash/logger.rb +++ b/lib/rackstash/logger.rb @@ -150,6 +150,11 @@ module Rackstash buffer.tags end + # (see Buffer#timestamp) + def timestamp(time = nil) + buffer.timestamp(time) + end + # Log a message at the DEBUG log level. # # @param msg (see #add) diff --git a/spec/rackstash/logger_spec.rb b/spec/rackstash/logger_spec.rb index 6923e13..9ab79d2 100644 --- a/spec/rackstash/logger_spec.rb +++ b/spec/rackstash/logger_spec.rb @@ -222,6 +222,21 @@ describe Rackstash::Logger do end end + describe '#timestamp' do + it 'forwards to the Buffer' do + buffer = instance_double('Rackstash::Buffer') + expect(logger).to receive(:buffer).and_return(buffer) + expect(buffer).to receive(:timestamp) + + logger.timestamp + end + + it 'implements the same method signature as the Buffer' do + expect(Rackstash::Buffer.instance_method(:timestamp).parameters) + .to eql logger.method(:timestamp).parameters + end + end + describe '#add' do let(:messages) { [] }