import ( "io" "io/ioutil" "os" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pivotal-cf/cf-redis-broker/log" "github.com/pivotal-golang/lager" ) var _ = Describe("CliSink", func() { var ( stdoutReader io.Reader originalStdout *os.File sink lager.Sink ) BeforeEach(func() { originalStdout = os.Stdout stdoutReader, os.Stdout, _ = os.Pipe() sink = log.NewCliSink(lager.INFO) }) AfterEach(func() { os.Stdout = originalStdout }) Describe(".Log", func() { Context("when the payload doesn't have lager data with event key", func() {
package lager_test import ( "runtime" "sync" "github.com/pivotal-golang/lager" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("WriterSink", func() { const MaxThreads = 100 var sink lager.Sink var writer *copyWriter BeforeSuite(func() { runtime.GOMAXPROCS(MaxThreads) }) BeforeEach(func() { writer = NewCopyWriter() sink = lager.NewWriterSink(writer, lager.INFO) }) Context("when logging above the minimum log level", func() { BeforeEach(func() { sink.Log(lager.INFO, []byte("hello world")) })