Sha256: abfe8b68ae214738f9bc44cea30f606523f499aec76759bfda9ccb0b7ecb6624

Contents?: true

Size: 612 Bytes

Versions: 9

Compression:

Stored size: 612 Bytes

Contents

require "test_helper"

describe Pliny::Log do
  before do
    @io = StringIO.new
    Pliny.stdout = @io
    stub(@io).puts
  end

  it "logs in structured format" do
    mock(@io).puts "foo=bar baz=42"
    Pliny.log(foo: "bar", baz: 42)
  end

  it "supports blocks to log stages and elapsed" do
    mock(@io).puts "foo=bar at=start"
    mock(@io).puts "foo=bar at=finish elapsed=0.000"
    Pliny.log(foo: "bar") do
    end
  end

  it "merges context from RequestStore" do
    Pliny::RequestStore.store[:log_context] = { app: "pliny" }
    mock(@io).puts "app=pliny foo=bar"
    Pliny.log(foo: "bar")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pliny-0.2.1 test/log_test.rb
pliny-0.2.0 test/log_test.rb
pliny-0.1.0 test/log_test.rb
pliny-0.0.4 test/log_test.rb
pliny-0.0.3 test/log_test.rb
pliny-0.0.1 test/log_test.rb
pliny-0.0.1.pre3 test/log_test.rb
pliny-0.0.1.pre2 test/log_test.rb
pliny-0.0.1.pre test/log_test.rb