github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/examples/printf_logging/main.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/v2pro/plz/countlog/output"
     5  	. "github.com/v2pro/plz/countlog"
     6  	"github.com/v2pro/plz/countlog/output/printf"
     7  )
     8  
     9  func main() {
    10  	EventWriter = output.NewEventWriter(output.EventWriterConfig{
    11  		Format: &printf.Format{
    12  			`[{level}] ` +
    13  				`{timestamp, goTime, 15:04:05} ` +
    14  				`{message} @ {file}:{line}`},
    15  	})
    16  	Info("{userA} called {userB} at {sometime}",
    17  		"userA", "lily",
    18  		"userB", "tom",
    19  		"sometime", "yesterday")
    20  	Info("{userA} called {userB} at {sometime}",
    21  		"userA", "lily",
    22  		"userB", "tom",
    23  		"sometime", "yesterday")
    24  }