github.com/furusax0621/goa-v1@v1.4.3/logging/kit/adapter_test.go (about)

     1  package goakit_test
     2  
     3  import (
     4  	"bytes"
     5  
     6  	"github.com/go-kit/kit/log"
     7  	"github.com/goadesign/goa"
     8  	goakit "github.com/goadesign/goa/logging/kit"
     9  	. "github.com/onsi/ginkgo"
    10  	. "github.com/onsi/gomega"
    11  )
    12  
    13  var _ = Describe("New", func() {
    14  	var buf bytes.Buffer
    15  	var logger log.Logger
    16  	var adapter goa.LogAdapter
    17  
    18  	BeforeEach(func() {
    19  		logger = log.NewLogfmtLogger(&buf)
    20  		adapter = goakit.New(logger)
    21  	})
    22  
    23  	It("creates an adapter that logs", func() {
    24  		msg := "msg"
    25  		adapter.Info(msg)
    26  		Ω(buf.String()).Should(Equal("lvl=info msg=" + msg + "\n"))
    27  	})
    28  })