github.com/ssgreg/logf@v1.4.1/README.md (about) 1 # logf 2 3 [](https://godoc.org/github.com/ssgreg/logf) 4 [](https://github.com/ssgreg/logf/actions/workflows/go.yml) 5 [](https://goreportcard.com/report/github.com/ssgreg/logf) 6 [](https://codecov.io/gh/ssgreg/logf) 7 8 Faster-than-light, asynchronous, structured logger in Go with zero allocation count. 9 10 ## Example 11 12 The following example creates a new `logf` logger and logs a message. 13 14 ```go 15 package main 16 17 import ( 18 "runtime" 19 20 "github.com/ssgreg/logf" 21 ) 22 23 func main() { 24 // The default channel writer writes to stdout using json encoder. 25 writer, writerClose := logf.NewChannelWriter.Default() 26 defer writerClose() 27 28 logger := logf.NewLogger(logf.LevelInfo, writer) 29 30 logger.Info("got cpu info", logf.Int("count", runtime.NumCPU())) 31 } 32 ``` 33 34 The output is the following: 35 36 ```json 37 {"level":"info","ts":"2018-11-03T09:49:56+03:00","msg":"got cpu info","count":8} 38 ``` 39 40 ## Benchmarks 41 42 TODO 43 44 ## TODOs 45 46 Benchmarks: 47 48 * benchmarks descriptions 49 * non-parallel execution explanation 50 * scenario decomposition 51 * use zerolog object and array marshaller 52 * add checked logging for normal (not disabled) cases 53 54 Encoder: 55 56 * move to clone 57 * use EscapeString instead