github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/consensus/abci/execute_tx_test.go (about)

     1  package abci
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  
     7  	"github.com/go-kit/kit/log"
     8  	"github.com/hyperledger/burrow/logging"
     9  	"github.com/stretchr/testify/require"
    10  	"github.com/tendermint/tendermint/abci/types"
    11  )
    12  
    13  func TestWithEvents(t *testing.T) {
    14  	var buf bytes.Buffer
    15  	logger := logging.NewLogger(log.NewLogfmtLogger(&buf))
    16  	kvp := types.EventAttribute{Key: []byte("foo"), Value: []byte("bar")}
    17  	event := types.Event{Type: "event", Attributes: []types.EventAttribute{kvp}}
    18  	events := []types.Event{event}
    19  	logger = WithEvents(logger, events)
    20  	logger.InfoMsg("hello, world")
    21  	require.Equal(t, "log_channel=Info event=foo:bar message=\"hello, world\"\n", buf.String())
    22  }