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

     1  package output
     2  
     3  import "github.com/v2pro/plz/countlog/spi"
     4  
     5  type Format interface {
     6  	FormatterOf(site *spi.LogSite) Formatter
     7  }
     8  
     9  type Formatter interface {
    10  	Format(space []byte, event *spi.Event) []byte
    11  }
    12  
    13  type Formatters []Formatter
    14  
    15  func (formatters Formatters) Format(space []byte, event *spi.Event) []byte {
    16  	for _, formatter := range formatters {
    17  		space = formatter.Format(space, event)
    18  	}
    19  	return space
    20  }