var _ = Describe("ReconfigurableSink", func() {
	var (
		testSink *lagertest.TestSink

		sink *lager.ReconfigurableSink
	)

	BeforeEach(func() {
		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"))
예제 #2
0
var _ = Describe("ReconfigurableSink", func() {
	var (
		testSink *lagertest.TestSink

		sink *lager.ReconfigurableSink
	)

	BeforeEach(func() {
		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"))