github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/countlog/output/compact/timestamp.go (about)

     1  package compact
     2  
     3  import (
     4  	"github.com/v2pro/plz/countlog/spi"
     5  	"time"
     6  )
     7  
     8  type timestampFormatter struct {
     9  }
    10  
    11  func (formatter *timestampFormatter) Format(space []byte, event *spi.Event) []byte {
    12  	space = append(space, ("[" + spi.LevelName(event.Level) + "]")...)
    13  	space = append(space, ' ', '[')
    14  	return append(event.Timestamp.AppendFormat(space, time.RFC3339), ']')
    15  }