- Thread-safe logger
- Log formatting support
- Logging in unstructured or structured format (JSON)
go get github.com/ric-v/glog
simple logger to stdout
package main
import "github.com/ric-v/glog"
func main() {
defer glog.Cleanup()
// log the message to the default concurrent logger
glog.Info("Hello World")
}
json logger to file
package main
import "github.com/ric-v/glog"
func main() {
logger := glog.JSONGlogger("glogger.log")
defer logger.Cleanup()
// log the message to custom json logger
logger.Info("", "Hello", "World")
}
Benchmark | Iterations | Time | Size | Allocation |
---|---|---|---|---|
BenchmarkJSONGlog | 266092 | 3853 ns/op | 2185 B/op | 25 allocs/op |
BenchmarkUnstructureGlog_log | 412342 | 3054 ns/o | 984 B/op | 13 allocs/op |
visit examples here
Code.Share.Prosper