Wrapping the zap log uber in the zapper package makes it easy to use zap to write logs to varianty core.
feature
- available cores (console, file, sentry, json)
- show stacktrace in log
- log file rotation using lumberjack
- create multiple core in same time
- add service details to zapper
- compatibility with ELK using json core
- compatibility with some software architecture scenario
- 100% compatibility with sentry using sentry core
package main
import (
"github.com/GoFarsi/zapper"
"log"
)
func main() {
z := zapper.New(false, zapper.WithDebugLevel())
if err := z.NewCore(
zapper.ConsoleWriterCore(true),
zapper.FileWriterCore("./test_data", nil),
); err != nil {
log.Fatal(err)
}
z.Debug("debug log")
z.Info("info log")
z.Warn("warn log")
z.Error("error log")
}
Repo: https://github.com/GoFarsi/zapper
Document: https://pkg.go.dev/github.com/GoFarsi/zapper
Top comments (0)