github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/countlog/output/hrf/hrf_test.go (about) 1 package hrf 2 3 import ( 4 "testing" 5 "github.com/v2pro/plz/countlog/spi" 6 "github.com/stretchr/testify/require" 7 ) 8 9 func Test_message(t *testing.T) { 10 should := require.New(t) 11 format := &Format{} 12 formatter := format.FormatterOf(&spi.LogSite{ 13 Event: "hello {key}", 14 Sample: []interface{}{"key", "world"}, 15 }) 16 output := formatter.Format(nil, &spi.Event{ 17 Properties: []interface{}{"key", "world"}, 18 }) 19 should.Equal("hello world\x1b[90;1m\nkey: world\x1b[0m\x1b[90;1m\x1b[0m\n", string(output)) 20 }