Sha256: dd041bdce5bf70110e7be3e6373bc0bb70d0458644b7a15f74e720d599a0d2a3

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'

describe CopycopterClient::PrefixedLogger do
  let(:output_logger) { FakeLogger.new }
  let(:prefix) { "** NOTICE:" }
  let(:thread_info) { "[P:#{Process.pid}] [T:#{Thread.current.object_id}]" }
  subject { CopycopterClient::PrefixedLogger.new(prefix, output_logger) }

  it "provides the prefix" do
    subject.prefix.should == prefix
  end

  it "provides the logger" do
    subject.original_logger.should == output_logger
  end

  [:debug, :info, :warn, :error, :fatal].each do |level|
    it "prefixes #{level} log messages" do
      message = 'hello'
      subject.send(level, message)

      output_logger.should have_entry(level, "#{prefix} #{thread_info} #{message}")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
copycopter_client-1.0.0.beta2 spec/copycopter_client/prefixed_logger_spec.rb
copycopter_client-1.0.0.beta1 spec/copycopter_client/prefixed_logger_spec.rb