コード例 #1
0
		testSink = lagertest.NewTestSink()

		sink = lager.NewReconfigurableSink(testSink, lager.INFO)
	})

	It("returns the current level", func() {
		Expect(sink.GetMinLevel()).To(Equal(lager.INFO))
	})

	Context("when logging above the minimum log level", func() {
		BeforeEach(func() {
			sink.Log(lager.INFO, []byte("hello world"))
		})

		It("writes to the given sink", func() {
			Expect(testSink.Buffer()).To(gbytes.Say("hello world\n"))
		})
	})

	Context("when logging below the minimum log level", func() {
		BeforeEach(func() {
			sink.Log(lager.DEBUG, []byte("hello world"))
		})

		It("does not write to the given writer", func() {
			Expect(testSink.Buffer().Contents()).To(BeEmpty())
		})
	})

	Context("when reconfigured to a new log level", func() {
		BeforeEach(func() {
コード例 #2
0
		testSink = lagertest.NewTestSink()

		sink = lager.NewReconfigurableSink(testSink, lager.INFO)
	})

	It("returns the current level", func() {
		Ω(sink.GetMinLevel()).Should(Equal(lager.INFO))
	})

	Context("when logging above the minimum log level", func() {
		BeforeEach(func() {
			sink.Log(lager.INFO, []byte("hello world"))
		})

		It("writes to the given sink", func() {
			Ω(testSink.Buffer()).Should(gbytes.Say("hello world\n"))
		})
	})

	Context("when logging below the minimum log level", func() {
		BeforeEach(func() {
			sink.Log(lager.DEBUG, []byte("hello world"))
		})

		It("does not write to the given writer", func() {
			Ω(testSink.Buffer().Contents()).Should(BeEmpty())
		})
	})

	Context("when reconfigured to a new log level", func() {
		BeforeEach(func() {